Sign in Join

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

Mailing lists / lazarus / 2020-12

Getting sourceline from stacktrace address

10 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Pascal Riekenberg

Good evening,

how can i get the sourceline from a stacktrace address?

I use heaptrc to find a double free. The problem is that producing the stacktrace on double free also runs into the error and only produces the list of addresses. KeepReleased is not an option here due to limited memory. 48 GB is not enough ;-(

Lazarus trunk, fpc trunk, x86_64, fpDebug, Dwarf3, Windows 10 20H2

Pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/efefd1ca/attachment.html>

Reply by email

Luca Olivetti
to Pascal Riekenberg

El 21/12/20 a les 20:12, Pascal Riekenberg via lazarus ha escrit:

Show quoted text 12 lines
Good evening, how can i get the sourceline from a stacktrace address? I use heaptrc to find a double free. The problem is that producing the stacktrace on double free also runs into the error and only produces the list of addresses. KeepReleased is not an option here due to limited memory. 48 GB is not enough ;-( Lazarus trunk, fpc trunk, x86_64, fpDebug, Dwarf3, Windows 10 20H2

I don't know with X86_64, but with windows 32 I load the exe in gdb then

info line *0x01234abcd

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Martin Frb
to Pascal Riekenberg: how can i get the sourceline from a stacktrace address? I use heaptrc to find a double…
Pascal Riekenberg wrote 12 lines
Good evening, how can i get the sourceline from a stacktrace address? I use heaptrc to find a double free. The problem is that producing the stacktrace on double free also runs into the error and only produces the list of addresses. KeepReleased is not an option here due to limited memory. 48 GB is not enough ;-( Lazarus trunk, fpc trunk, x86_64, fpDebug, Dwarf3, Windows 10 20H2

If you have the exe, and the exe has debug info:
- paste the stacktrace into menu: View > Leaks and traces
- Press "Resolve" and select the exe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/d3acf4c6/attachment.html>

Reply by email

Martin Frb
to Martin Frb
Martin Frb wrote 8 lines
On 21/12/2020 20:12, Pascal Riekenberg via lazarus wrote: > Good evening, > > how can i get the sourceline from a stacktrace address? > > I use heaptrc to find a double free. The problem is that producing > the stacktrace on double free >

Also if you are on Linux: compile with: -gv

And use
valgrind --tool=memcheck yourapp

This should get you much better info.
- Trace for access after free
- Trace for the free call
- Trace where it was allocated

Though, your app will run a lot slower in valgrind.... -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/b5680fa5/attachment.html>

Reply by email

Pascal Riekenberg
to Luca Olivetti: El 21/12/20 a les 20:12, Pascal Riekenberg via lazarus ha escrit: I don't know with…

Thanks! That works. But with many manual copy and paste.

Pascal

Show quoted text 31 lines
Luca Olivetti via lazarus hat am 21.12.2020 20:21 geschrieben: El 21/12/20 a les 20:12, Pascal Riekenberg via lazarus ha escrit: > Good evening, > > how can i get the sourceline from a stacktrace address? > > I use heaptrc to find a double free. The problem is that producing the > stacktrace on double free > also runs into the error and only produces the list of addresses. > KeepReleased is not an option here > due to limited memory. 48 GB is not enough ;-( > > Lazarus trunk, fpc trunk, x86_64, fpDebug, Dwarf3, Windows 10 20H2 > I don't know with X86_64, but with windows 32 I load the exe in gdb then info line *0x01234abcd Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Pascal Riekenberg
to Martin Frb: If you have the exe, and the exe has debug info: - paste the stacktrace into menu: View >…

Thanks! This works even better and also with direct jump to source.

Pascal

Show quoted text 25 lines
Martin Frb via lazarus hat am 21.12.2020 20:27 geschrieben: On 21/12/2020 20:12, Pascal Riekenberg via lazarus wrote: > > Good evening, > > how can i get the sourceline from a stacktrace address? > > I use heaptrc to find a double free. The problem is that producing the stacktrace on double free > also runs into the error and only produces the list of addresses. KeepReleased is not an option here > due to limited memory. 48 GB is not enough ;-( > > Lazarus trunk, fpc trunk, x86_64, fpDebug, Dwarf3, Windows 10 20H2 > > > > If you have the exe, and the exe has debug info: - paste the stacktrace into menu: View > Leaks and traces - Press "Resolve" and select the exe. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/245fd5fa/attachment.html>

Reply by email

Martin Frb
to Pascal Riekenberg: Thanks! This works even better and also with direct jump to source. Pascal --------------…
Pascal Riekenberg wrote
Thanks! This works even better and also with direct jump to source.

The resolved lines from the heaptrc should also jump to source.

If not, can I have examples?

And  a screenshot what was shown after resolve (or the exe to resolve the example)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/af27e060/attachment-0001.html>

Reply by email

Pascal Riekenberg
to Martin Frb
Show quoted text 10 lines
Martin Frb via lazarus hat am 21.12.2020 21:11 geschrieben: On 21/12/2020 20:55, Pascal Riekenberg via lazarus wrote: > > Thanks! This works even better and also with direct jump to source. > > > > The resolved lines from the heaptrc should also jump to source.

Yes, works like a charm ;-)

What about resolving to exe of current project instead of searching for exe manualy, at least as option?

Show quoted text 9 lines
If not, can I have examples? And a screenshot what was shown after resolve (or the exe to resolve the example)? -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/d0a135d8/attachment.html>

Reply by email

Martin Frb
to Pascal Riekenberg
Pascal Riekenberg wrote 6 lines
> The resolved lines from the heaptrc should also jump to source. Yes, works like a charm ;-) What about resolving to exe of current project instead of searching for exe manualy, at least as option?

Its an idea, yes.

The original use case was for dealing with traces from releases.
- build your release (with ability to log traces to a file) with debug line
- take a copy
- strip the release / ship it
Now if anyone got an error in the release, they could send the logfile, and you could use the addresses, to get full source info.

But it then also became useful, because the build in trace dump would sometimes stop resolving (if it encountered just ONE address that did not resolve).
So for that, the current exe is an option.

Important is, that the exe was not rebuild since the trace was done. => New build => new address to line mapping (at least potentially).

You can make a feature request. But it will be a while before I can even next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201221/7d64a84c/attachment.html>

Reply by email