gdb - Can I debug a core generated by a C++ binary without debug symbols using the same binary recompiled with debug symbols -
i trying debug core file generated c++ binary without debug symbols. in order effective debugging, need debug symbols, i've recompiled same code -g option in order generate debug symbols in recompiled binary. can debug same core file generated first binary (without debug symbols) using second binary (has debug symbols, else same) ?
thanks lot !
if compiled original executable e.g. g++ -o2 ...
, can not (as have discovered) use new executable built g++ -g ...
debug core
-- gdb needs symbols match, , not (due difference in optimization levels).
what can build new executable same optimization original, also debug symbols: g++ -o2 -g ...
.
after you've built new executable, run nm old.a.out > old.nm
, nm new.a.out > new.nm
, compare outputs. should identical or very close.
if are, should able debug core
produced old.a.out using new.a.out.
in future, should build executable debug symbols, keep full copy, ship copy without debug info:
cp a.out a.out.debug strip --strip-debug a.out # a.out send customers # keep a.out.debug future debugging
Comments
Post a Comment