Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Making use of backtrace?

Name: Anonymous 2010-09-01 6:00

Incoming wall of text.

I want to be able to make use of the backtrace function in order to ease debugging when my application crashes for a user. I found an implementation which seems to work on MinGW, so on the target platforms I can pretty much use SEH or signals to catch a crash, get a backtrace and do something with it (I also realize that sometimes, I won't be able to do anything good in the handler due to the state of the application. I'm willing to take that risk.)

The problem is, I don't know where to begin. I of course need the debugging information to be on a server of sorts, but I'm not even sure what I should do to get this information. How do I generate it? I know gdb can determine what line of code an address is, and I'm guessing gdb is using embedded debug info - but I can't find any reasonable sources of information for the format or how I could do this without the information embedded (although I have a feeling i could just extract and strip, it sounds redundant to me.) I'm also not sure how, using signals, I would get the backtrace, since I'm pretty sure signal handlers get a different thread. (But hell if I know. I've never actually done one.)

I saw Google Breakpad, but this is an awful solution. I checked everything out from source and it seems it doesn't really work on Windows without hacking around, and definitely not with MinGW. It might be useful for reference, but i don't think it is actually helpful in my case. Too many dependencies, not enough docs, no MinGW support... not worth it.

Any advice? I'm new here, but I'm hoping unlike /g/ people here actually know their stuff. I'm primarily concerned with MinGW right now, since I bet this will be much simpler under Linux and etc.

Name: Anonymous 2010-09-01 6:35

>>4
Thanks for the time. I will check out the links.

As for my problem, I eventually realized that I could use objcopy to extract the debug info. With more googling, I hit a Stack Overflow which lead me to exactly what I needed to do. So I wrote a small test and sure enough was able to create a separated debug file. It worked in MinGW gdb.

So, I may change my game plan: gdb is capable of reading a dump file and symbols. If I could produce a dump file, I could probably get a decent amount of information using that coupled with symbols, no extra software. Lazy, perhaps, but I have a feeling a dump file would be more useful if possible. I'm worried though as I'm not sure just how much information is contained in a dump file. Will have to research.

As for getting the function arguments, hmm. I'll look into it. I know if I do it the way I'm thinking, it will most likely end up needing an implementation for each architecture, but if that ends up only being x86 and x86-64 it's not such a big deal.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List