-
Notifications
You must be signed in to change notification settings - Fork 45
Conversation
} | ||
} | ||
} else { // SymFromAddr() failed, just print the address | ||
fprintf(fp, "%2d: [pc=0x%p]\n", i, pSymbol->Address); | ||
fprintf(fp, "%2d: [pc=0x%p]\n", i, | ||
reinterpret_cast<void*>(pSymbol->Address)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If SymFromAddr()
fails, is pSymbol->Address
valid here?
@rnchamberlain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that line was copied from 4 lines above, where SymFromAddr() has succeeded. The SymFromAddr() call might copy the address into pSymbol->Address in failure cases, but yes, it would be better/more logical to use dwAddress instead at this point. Can you add that to your fix? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
46dfc27
to
356c58a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fprintf(fp, "%2d: [pc=0x%p] %s [+%d] in %s: line: %lu\n", i, pSymbol->Address, pSymbol->Name, dwOffset, line.FileName, line.LineNumber); | ||
fprintf(fp, "%2d: [pc=0x%p] %s [+%d] in %s: line: %lu\n", i, | ||
reinterpret_cast<void*>(pSymbol->Address), pSymbol->Name, | ||
dwOffset, line.FileName, line.LineNumber); | ||
} else { | ||
// SymGetLineFromAddr64() failed, just print the address and symbol | ||
if (dwOffset64 <= 32) { // sanity check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rnchamberlain Is this sanity check valid? It seems to be consistently failing for me and we drop into the else clause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nb. Consistently dropping into the else clause here is why only test-api.js
is failing in #26 as it's succeeding the SymGetLineFromAddr64
call -- The other tests fail the call and then fail the sanity check. The original fprintf
for the else clause of the sanity check doesn't have parameters after the pSymbol->Address
argument, so there the fprintf
call there didn't crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pSymbol->Address is ULONG64 but fprintf's %p format on x86 expects 32-bits. Fixes nodejs#26
356c58a
to
84cb4e4
Compare
Updated. I've dropped the sanity check as it seemed wrong and prevents the name of the method being printed. |
@richardlau I can't remember why that |
Landed as d988b6c |
pSymbol->Address
isULONG64
butfprintf
's%p
format on x86 expects 32-bits.Also wrapped the long edited lines.
Fixes #26