Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-06

is there a way to get Call stack on WinCE-device

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tommi Prami

Hello,

I would need to have Call Stack extracted programmatically some how.

Is there way to do that?? Or anyone have such a piece of code and instructions available??

I have some mysterious (unhandled) exceptions happenign in the app, and would be very handy to get the Call Stack when ever that happen, so would be much easier to narrow the code down where it actually happens... We have simple logger and it also logs the Unhadled exception (the aoolication event chish I don't remember just now :) OnExcetoion or so ). And there appears some weird ones from the unknow source. Mainly there are try except clocks and exceptions are lofgged with information of the method it happened in. But I would not like the idea to put try except block everywhere...

All ideas are welcome...

-Tommi Prami-

Reply by email

Sven Barth
to Tommi Prami
Tommi Prami wrote 6 lines
Hello, I would need to have Call Stack extracted programmatically some how. Is there way to do that?? Or anyone have such a piece of code and instructions available??

When you have catched the exception (e.g. in a OnException handler of the application) you can do a "DumpExceptionBackTrace" which takes a file as a parameter (see here:
http://www.freepascal.org/docs-html/rtl/system/dumpexceptionbacktrace.html )

Please note that on WinCE the line information resolving is not working (see here http://bugs.freepascal.org/view.php?id=14330 ) and thus only the addresses will be resolved. You can resolve that by using a arm-wince gdb and starting it like this:

gdb --exec=your-wince-executable --symbols=your-wince-dbg-file -x stacktrace.txt

where stacktrace.txt is your stacktrace where the lines are changed from "$1234ABCD" to "info source 0x1234ABCD" (or it could be "info address 0x1234ABCD"...)

GDB should then print the line numbers for the addresses.

Regards,
Sven

Reply by email

Tommi Prami
to Sven Barth
Sven Barth wrote 28 lines
Am 21.06.2012 09:01, schrieb Tommi Prami: > Hello, > > I would need to have Call Stack extracted programmatically some how. > > Is there way to do that?? Or anyone have such a piece of code and > instructions available?? When you have catched the exception (e.g. in a OnException handler of the application) you can do a "DumpExceptionBackTrace" which takes a file as a parameter (see here: http://www.freepascal.org/docs-html/rtl/system/dumpexceptionbacktrace.html ) Please note that on WinCE the line information resolving is not working (see here http://bugs.freepascal.org/view.php?id=14330 ) and thus only the addresses will be resolved. You can resolve that by using a arm-wince gdb and starting it like this: gdb --exec=your-wince-executable --symbols=your-wince-dbg-file -x stacktrace.txt where stacktrace.txt is your stacktrace where the lines are changed from "$1234ABCD" to "info source 0x1234ABCD" (or it could be "info address 0x1234ABCD"...) GDB should then print the line numbers for the addresses.

Almost got it working tested in Win32, I think there is something weird in my Compiler options (Or linking), got simple files with the addresses, still got the :

Reading symbols from c:\MyProg.dbg...done.
No current source file.
No current source file.
No current source file.
No current source file.
...

as result from the Gdb...

Any ideas, I try somethin on my end...

-Tee-

Reply by email