Skip to content

Commit

Permalink
Fix SuperPMI assertion call in MethodContext::recGetHelperFtn() (#9…
Browse files Browse the repository at this point in the history
…0778)

* Fix SuperPMI assertion call in `MethodContext::recGetHelperFtn()`

We can't use string concatenation in an argument to the `AssertCodeMsg`
macro, so construct the string we want to print first.

* Feedback
  • Loading branch information
BruceForstall authored Aug 18, 2023
1 parent e6f3f0c commit 028ad32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/tools/superpmi/superpmi-shared/errorhandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void MSC_ONLY(__declspec(noreturn)) ThrowRecordedException(DWORD innerExceptionC
do \
{ \
if (!(expr)) \
LogException(exCode, "SuperPMI assertion '%s' failed (" #msg ")", #expr, ##__VA_ARGS__); \
LogException(exCode, "SuperPMI assertion '%s' failed (" msg ")", #expr, ##__VA_ARGS__); \
} while (0)

#define AssertCode(expr, exCode) \
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/superpmi/superpmi-shared/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
do \
{ \
Logger::LogExceptionMessage(__FUNCTION__, __FILE__, __LINE__, exCode, msg, __VA_ARGS__); \
ThrowSpmiException(exCode, msg, __VA_ARGS__); \
ThrowSpmiException(exCode, msg, __VA_ARGS__); \
} while (0)

// These are specified as flags so subsets of the logging functionality can be enabled/disabled at once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,7 @@ void MethodContext::recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection
DLDL oldValue = GetHelperFtn->Get(key);

AssertCodeMsg(oldValue.A == value.A && oldValue.B == oldValue.B, EXCEPTIONCODE_MC,
"collision! old: %016" PRIX64 " %016" PRIX64 ", new: %016" PRIX64 " %016" PRIX64 " \n", oldValue.A, oldValue.B, value.A,
"collision! old: %016" PRIX64 " %016" PRIX64 ", new: %016" PRIX64 " %016" PRIX64, oldValue.A, oldValue.B, value.A,
value.B);
}

Expand Down

0 comments on commit 028ad32

Please sign in to comment.