This repository was archived by the owner on Jun 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
Add filename / line number to stack traces on Windows. #534
Copy link
Copy link
Closed
Labels
Milestone
Description
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!
Reactions are currently unavailable