When debugging e.g. a cdecl call to a standard library, how can one inspect the top few words on the stack?
Mailing lists / lazarus / 2012-08
Viewing stack content
7 messages · 2 people ·
- MMartin 4
- MMark Morgan Lloyd 3
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Mark Morgan Lloyd wroteWhen debugging e.g. a cdecl call to a standard library, how can one inspect the top few words on the stack?
Usually at least the top most frame is shown (though locals, and params may not)
If further frames or some info is missing, then it usually means gdb does not know how to read the stackframe.
Not sure what can be done.
Martin wrote 12 lines
If you mean raw memory
depends on cpu. Intel with esp, add a watch, set to memory dump: ^Byte($esp)[-20]
starts 20 bytes before esp
Martin wrote 19 lines
Thanks, I think that'll do. I'm trying to sort out a shared library call- the interface to the library is working properly but I suspect a higher-level shim is confusing a pointer and a value somewhere.
Mark Morgan Lloyd wrote 12 lines
If you wont words, and use laz trunk, instead of memory-dump, you can set the watches "repeat count" to see multiple indexed elements, following the given one.
Then you can typecast ^word. The index is not in bytes, but whatever the size of the specified type
Martin wrote 20 lines
Thanks, I'll try that later. I noticed the checkbox on the non-trunk version on this machine, but it doesn't yet have any effect.
Mark Morgan Lloyd wrote 11 lines
Checkbox? You mean edit?
http://wiki.lazarus.freepascal.org/IDE_Window:_Watch_list#Watch_Properties
Show quoted text 9 lines
A pointer, acts like an array, because it can be dereferenced using an index
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120809/31a24026/attachment.html>
