I am in need to debug one app that didn't crash but instead stuck at some point. The usual printf way didn't help much, so I want to do as people do with GDB: they load up a binary, waiting till the necessary moment, press "ctrl+c" and then type "backtrace" and they see the current stack trace.
Now, with our GDB it can works if only our current GCC didn't produce Dwarf4 debug based binaries (as it now what all the ppls use in whole worlds), but our GDB is too old, and can only handle Dwarf2 binaries. So I need to rebuild adtools the apply the necessary patch so it will build Dwarf2 based bins. Not sure though if there also will be no needs to rebuild all link libraries too :(
So, I tried DB101: while it loads up fine, etc, etc it just didn't have the functionality to broke the process when I need and to see stack trace (at least I can't see).
Then I tried SpotLess: that one even didn't work. It runs, i can load up binary, but when I hit "start" nothing happens.
Now, question: maybe we have some debug-app, just to watch stack-trace at the time we need to give app? Maybe just some tool, which we run like "stack watch binary", and then it handles some key-combo, which when we press, just open up a window with a stack trace?
The problem is the ancient version of binutils in adtools. It needs some love, from someone with a lot of patience. It's a very hairy patchset for a very hairy piece of code.
@sTix Yeah, I know :) That need to deal with the issue somehow now, not tomorrow :)
Dunno, maybe it needs to be written just some simple thing that will do exactly that: attach to the process, wait for the key combo, and then dump stack trace of a process once the combo is recieved.
I just think it is somewhere written already, just can't remember what/where.
So only (i hope) need to rebuild my gcc and it will produce dwarf2 bins and i will be able to do that in our ancient gcc. At least, that it more realistic than new GDB port which no one able to do in latest 15 years :)
Yeah, I know :) That need to deal with the issue somehow now, not tomorrow :)
Dunno, maybe it needs to be written just some simple thing that will do exactly that: attach to the process, wait for the key combo, and then dump stack trace of a process once the combo is recieved.
I just think it is somewhere written already, just can't remember what/where.
I understand. I don't think we can find anyone that can / want to update binutils before midnight so I'm afraid you need to resort to something more creative
Nothing I can understand :) I then just ask the authors about it, and they say that they need stack trace on the moment the game stuck. So, fighting with that piece of shit. I hope that once I get the backtrace and send it to them, they, as authors, will help out to fix it.
So only (i hope) need to rebuild my gcc and it will produce dwarf2 bins and i will be able to do that in our ancient gcc. At least, that it more realistic than new GDB port which no one able to do in latest 15 years :)
Ah, it's that simple. Sounds like a stop gap solution if it works.
Nothing I can understand :) I then just ask the authors about it, and they say that they need stack trace on the moment the game stuck. So, fighting with that piece of shit. I hope that once I get the backtrace and send it to them, they, as authors, will help out to fix it.
Ah, yes if the authors are willing to take a look I can understand that they want more than just printf output.
I'm working on your namespace problems BTW. It was a bit more work than I antecipated, lots of things missing in clib2.
A program can’t stack trace itself, you need start a process that can do it, next you need suspend main program process, run stack trace on main program process, unsuspend main program, and exit debug process. continue program. something like that anyway.
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
To get a stack trace from a specific point in a program you can just insert in the source code a:
IExec->SuspendTask(NULL, STF_CRASHED)
there and it should bring up the grim reaper.
Or you could just do something like:
*(char *)0 = 0;
A problem that I didn't know where I stuck in the code (because of too much for's loops, ifs, and elses) So I want to grab stack trace when I see issue visually without knowing where the issue in code is.
Quote:
Using Ranger you can also get a stack trace from any running program by selecting it from the process list and clicking the button next to "Stack:".
Yeah, thanks! While it didn't resolve symbols in the app itself, I still can get addresses and via addr2line got the necessary ones.
Through, what is interesting, when I run the game and go to the menu, and click on that "stack" button, it shows me many addresses as expected in the stack trace (and kernel, and graphics libs, and many addresses from my binary). Then once I run it and game stuck on loading md5 mesh, then in the stack trace of ranger all I have is 2 lines:
0x7ee4fe88 0x1EDE70 game 9x91a628e9 0x87e8 newlib.library.kmod
Where all the functions went which call that one ?:)
Anyway, seems that this is for real the function where i stuck! And it looks like this:
Note that the SAFE_RIGHT_SHIFT needs to be modified if it's to work with signed values (where sign bit should be copied into new bits that are shifted in from the left).