Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filename / line number to stack traces on Windows. #534

Closed
bmahler opened this issue Mar 13, 2020 · 0 comments · Fixed by #1051
Closed

Add filename / line number to stack traces on Windows. #534

bmahler opened this issue Mar 13, 2020 · 0 comments · Fixed by #1051
Milestone

Comments

@bmahler
Copy link

bmahler commented Mar 13, 2020

Currently the glog stack trace facilities on Windows do not include file name and line number information (nor does the code for Linux as far as I can tell).

It's possible to retrieve file name and line number information using the following:

// Include SYMOPT_LOAD_LINES in SymSetOptions:
SymSetOptions(... | SYMOPT_LOAD_LINES);

...

// Later, when calling SymFromAddr, also call SymGetLineFromAddr64:
DWORD lineDisplacement = 0;
IMAGEHLP_LINE64 line = {};
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);

BOOL lineFound = SymGetLineFromAddr64(
    GetCurrentProcess(),
    reinterpret_cast<DWORD64>(pc),
    &lineDisplacement,
    &line);

I was able to use this to dump file names and line numbers:

E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	google::protobuf::internal::RepeatedPtrIterator<mesos::Resource_ReservationInfo const >::operator* [00007FF676253FEE+14] (c:\users\administrator\workspace\mesos\mesos_ci_windows-build-wip\mesos\build\3rdparty\protobuf-3.5.0\src\protobuf-3.5.0\src\google\protobuf\repeated_field.h:2266)
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000000D03DFFCA40+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	mesos::authorization::ActionObject::reserve [00007FF6778AFE40+720] (c:\users\administrator\workspace\mesos\mesos_ci_windows-build-wip\mesos\src\master\authorization.cpp:236)
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000000D03DFFC8A8+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000000D03DFFC9E8+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000000D03DFFC558+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [CCCCCCCCCCCCCCCC+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [CCCCCCCCCCCCCCCC+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000002ADCACC50F0+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000002ADC8AA0690+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000002ADC8AA0790+0]
E0000 00:00:00.000000  5928 logging.cpp:308] RAW: 	(No symbol) [000002ADC8AA0790+0]
...

Including these would helpful for debugging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants