summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-09-09 09:57:12 +0000
committerNicholas Clark <nick@ccl4.org>2021-09-09 09:57:12 +0000
commit7b6e25e427217d8a3b03cf4c6718be36a0fc221d (patch)
tree3421f8c2947647a40f94b7e9f0081ed315d0656c /util.c
parentd40d6ec1de056ca9f680dc099f85e2a535226ab3 (diff)
downloadperl-7b6e25e427217d8a3b03cf4c6718be36a0fc221d.tar.gz
The different xs_handshake() failures need distinct messages
xs_handshake() makes two different comparisons that on failure are reported as "got handshake key %p, needed %p", with opaque hexadecimal values. The first is the "actual" key as generated by the HS_KEY() macro, which encodes various values such as sizeof(PerlInterpreter) and the API version. The second is the address of the current thread's PerlInterpreter struct. Either can fail, and before this commit they would fail with identical text. Hence it wasn't obvious what the problem was, causing "confusion and delay" if one tried to decode the hexadecimal output as the wrong thing. (For example when it's actually pointers mismatching, but one tries to decode the values into API version and structure size, assuming that the values were the packed output from HS_KEY().)
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index f187145202..bf294b3d40 100644
--- a/util.c
+++ b/util.c
@@ -5588,6 +5588,7 @@ Perl_xs_handshake(const U32 key, void * v_my_perl, const char * file, ...)
U32 items, ax;
void * got;
void * need;
+ const char *stage = "first";
#ifdef MULTIPLICITY
dTHX;
tTHX xs_interp;
@@ -5624,12 +5625,13 @@ Perl_xs_handshake(const U32 key, void * v_my_perl, const char * file, ...)
got = xs_spp;
need = &PL_stack_sp;
#endif
+ stage = "second";
if(UNLIKELY(got != need)) {
bad_handshake:/* recycle branch and string from above */
if(got != (void *)HSf_NOCHK)
noperl_die("%s: loadable library and perl binaries are mismatched"
- " (got handshake key %p, needed %p)\n",
- file, got, need);
+ " (got %s handshake key %p, needed %p)\n",
+ file, stage, got, need);
}
if(key & HSf_SETXSUBFN) { /* this might be called from a module bootstrap */