Sign in Join

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

Mailing lists / fpc-pascal / 2011-02

Fingerprinting operation of a program

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Mark Morgan Lloyd

I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing.

Before I start giving myself a gdb refresher course or manually inserting trace messages, is there any way that I can extract a trace of procedure entry/exits, preferably identified by name rather than by address, using e.g. profiling hooks?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Sven Barth
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 9 lines
I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing. Before I start giving myself a gdb refresher course or manually inserting trace messages, is there any way that I can extract a trace of procedure entry/exits, preferably identified by name rather than by address, using e.g. profiling hooks?

You could try to compile your program using fpprofiler (it uses fpc in the background). See here:
http://wiki.lazarus.freepascal.org/wiki/FPProfiler

I've never used it before, but it might help you.

Regards,
Sven

Henry Vermaak
to Mark Morgan Lloyd: I need to trace through a program, running on two different systems which might or might…
Mark Morgan Lloyd wrote 8 lines
I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing. Before I start giving myself a gdb refresher course or manually inserting trace messages, is there any way that I can extract a trace of procedure entry/exits, preferably identified by name rather than by address, using e.g. profiling hooks?

Valgrind is probably what you need. It doesn't work on windows, but people use it with wine.

Henry

Mark Morgan Lloyd
to Henry Vermaak
Henry Vermaak wrote 13 lines
On 18 February 2011 18:19, Mark Morgan Lloyd wrote: > I need to trace through a program, running on two different systems which > might or might not have the same OS, in order to find out where it's > failing. > > Before I start giving myself a gdb refresher course or manually inserting > trace messages, is there any way that I can extract a trace of procedure > entry/exits, preferably identified by name rather than by address, using > e.g. profiling hooks? Valgrind is probably what you need. It doesn't work on windows, but people use it with wine.

Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600).

I'm about to start inserting debug messages. I might be some time.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Tomas Hajny
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 7 lines
Henry Vermaak wrote: > On 18 February 2011 18:19, Mark Morgan Lloyd > wrote: >> I need to trace through a program, running on two different systems >> which >> might or might not have the same OS, in order to find out where it's >> failing.

.
.

Show quoted text 9 lines
> Valgrind is probably what you need. It doesn't work on windows, but > people use it with wine. Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600). I'm about to start inserting debug messages. I might be some time.

One possible approximation may be to use the platform specific tools for tracing use of the platform APIs (I believe it's strace under Linux?) because it may provide some information even before adding the debug messages.

Tomas

Mark Morgan Lloyd
to Tomas Hajny
Tomas Hajny wrote 23 lines
On Sat, February 19, 2011 15:18, Mark Morgan Lloyd wrote: > Henry Vermaak wrote: >> On 18 February 2011 18:19, Mark Morgan Lloyd >> wrote: >>> I need to trace through a program, running on two different systems >>> which >>> might or might not have the same OS, in order to find out where it's >>> failing. . . >> Valgrind is probably what you need. It doesn't work on windows, but >> people use it with wine. > Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up > being a substantial amount of work for a one-off problem... FPP in > particular since it requires Lazarus to build but I'm trying to debug > part of the Lazarus build process (bug 0018600). > > I'm about to start inserting debug messages. I might be some time. One possible approximation may be to use the platform specific tools for tracing use of the platform APIs (I believe it's strace under Linux?) because it may provide some information even before adding the debug messages.

Thanks Tomas, had occurred to me but I don't know what's available for Windows (and whether it would run on the old version I'm looking at).

If I anticipated doing this regularly I think I'd look at modifying FPP to insert "entering" and "exiting" trace code. At a pinch something like kdiff3 would probably be able to make sense of a moderate-length output trace, but somewhere I've got a better text-comparison algorithm which would be more suitable.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Darius Blaszyk
to Mark Morgan Lloyd: Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a…
Mark Morgan Lloyd wrote 18 lines
Henry Vermaak wrote: > On 18 February 2011 18:19, Mark Morgan Lloyd > wrote: >> I need to trace through a program, running on two different systems which >> might or might not have the same OS, in order to find out where it's >> failing. >> >> Before I start giving myself a gdb refresher course or manually inserting >> trace messages, is there any way that I can extract a trace of procedure >> entry/exits, preferably identified by name rather than by address, using >> e.g. profiling hooks? > Valgrind is probably what you need. It doesn't work on windows, but > people use it with wine. Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600). I'm about to start inserting debug messages. I might be some time.

FPP does not require Lazarus to build. It does have a Lazarus frontend though.

Darius

Mark Morgan Lloyd
to Darius Blaszyk
Darius Blaszyk wrote 20 lines
On Feb 19, 2011, at 3:18 PM, Mark Morgan Lloyd wrote: > Henry Vermaak wrote: >> On 18 February 2011 18:19, Mark Morgan Lloyd >> wrote: >>> I need to trace through a program, running on two different systems which >>> might or might not have the same OS, in order to find out where it's >>> failing. >>> >>> Before I start giving myself a gdb refresher course or manually inserting >>> trace messages, is there any way that I can extract a trace of procedure >>> entry/exits, preferably identified by name rather than by address, using >>> e.g. profiling hooks? >> Valgrind is probably what you need. It doesn't work on windows, but >> people use it with wine. > Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600). > > I'm about to start inserting debug messages. I might be some time. > FPP does not require Lazarus to build. It does have a Lazarus frontend though.

"Currently building the tools from commandline is broken. To build them you should use Lazarus. Start by opening the lazarus project files:"

http://wiki.freepascal.org/FPProfiler

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]