Sign in Join

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

Mailing lists / fpc-pascal / 2009-09

map file

9 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Alexey Voytsehovich

Good day.
Do not prompt way to generate map file with line numbers in source code? By analogy with Delphi. Since not get to the addresses in the Call Stack to get a line in the source code.

Thanks in advance.

P.S.
Sorry for my English.

Best regards, Alexey Voytsehovich

Reply by email

Jonas Maebe
to Alexey Voytsehovich
Alexey Voytsehovich wrote
Do not prompt way to generate map file with line numbers in source code? By analogy with Delphi. Since not get to the addresses in the Call Stack to get a line in the source code.

Compile your program with -gl to get line numbers next to the call stack addresses. There is no way to generate a map file with the line numbers for FPC.

Jonas

Reply by email

Alexey Voytsehovich
to Jonas Maebe

Hello Jonas,

you wrote 8 lines
On 24 Sep 2009, at 10:14, Alexey Voytsehovich wrote: > Do not prompt way to generate map file with line numbers in source > code? By analogy with Delphi. Since not get to the addresses in the > Call Stack to get a line in the source code. Compile your program with -gl to get line numbers next to the call stack addresses.

Not. Prohibited by the laws of the company. :(

There is no way to generate a map file with the line numbers for FPC.

Do you plan this functional? Where can observe the development of any help?

Best regards, Alexey Voytsehovich

Reply by email

Jonas Maebe
to Alexey Voytsehovich: Not. Prohibited by the laws of the company. :( Do you plan this functional? Where can…
Alexey Voytsehovich wrote 10 lines
> On 24 Sep 2009, at 10:14, Alexey Voytsehovich wrote: >> Do not prompt way to generate map file with line numbers in source >> code? By analogy with Delphi. Since not get to the addresses in the >> Call Stack to get a line in the source code. > Compile your program with -gl to get line numbers next to the call > stack addresses. Not. Prohibited by the laws of the company. :(

Ok, so it is for distributed program. Compile the program with -g, keep the original copy for yourself and run "strip" on the copy that you distribute to your users. When you get a backtrace from a user, like this:

Runtime error 216 at $0000271C
$0000271C
$00002744
$00024720
$000026D0
$000023E0
$00001000

then you can look up the addresses in gdb:

gdb my-program-compiled-with-g-and-not-stripped
(gdb) info line *0x0000271C
Line 6 of "tt.pp" starts at address 0x2714 <TEST+20> and ends at 0x2720 <TEST+32>.

Jonas

Reply by email

Alexey Voytsehovich
to Jonas Maebe

Hello Jonas,

you wrote 14 lines
Runtime error 216 at $0000271C $0000271C $00002744 $00024720 $000026D0 $000023E0 $00001000 then you can look up the addresses in gdb: gdb my-program-compiled-with-g-and-not-stripped (gdb) info line *0x0000271C Line 6 of "tt.pp" starts at address 0x2714 <TEST+20> and ends at 0x2720 <TEST+32>.

Yes, it looks like what I need. :) Another question, can I use gdb as a reference? That is, from the command line to send him a request and get an answer. To check each address automatically, but before work to run a script that will fill the necessary data file record.

if i use this
gdb testexcept.exe info line *0x004015c3

i get this

Excess command line arguments ignored. (line ...)
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"...
\src\testexcept/info: No such file or directory.

Best regards, Alexey Voytsehovich

Reply by email

Jonas Maebe
to Alexey Voytsehovich
Alexey Voytsehovich wrote 7 lines
Yes, it looks like what I need. :) Another question, can I use gdb as a reference? That is, from the command line to send him a request and get an answer. To check each address automatically, but before work to run a script that will fill the necessary data file record. if i use this gdb testexcept.exe info line *0x004015c3

You should be able to do this:

echo "info line *0x004015c3" > gdb.txt
gdb -batch --command=gdb.txt

gdb should then execute all commands in gdb.txt (so you can add more commands to that text file if you want), and then quit. It is possible that gdb will expect unix linebreaks instead of Dos/Windows line breaks in this command file though. In that case, you will probably have to convert the line breaks of the gdb.txt file before passing it to gdb (the easiest way to do that is probably using a self-written program, or by finding a Windows version of the dos2unix utility).

Jonas

Reply by email

Jonas Maebe
to Jonas Maebe
Jonas Maebe wrote 8 lines
On 24 Sep 2009, at 10:59, Alexey Voytsehovich wrote: > gdb testexcept.exe info line *0x004015c3 You should be able to do this: echo "info line *0x004015c3" > gdb.txt gdb -batch --command=gdb.txt

Sorry,

gdb testexcept.exe -batch --command=gdb.txt

Jonas

Reply by email

Alexey Voytsehovich
to Jonas Maebe: You should be able to do this: echo "info line *0x004015c3" > gdb.txt gdb -batch…

Hello Jonas,

you wrote 14 lines
On 24 Sep 2009, at 10:59, Alexey Voytsehovich wrote: > Yes, it looks like what I need. :) Another question, can I use gdb as > a reference? That is, from the command line to send him a request and > get an answer. To check each address automatically, but before work to > run a script that will fill the necessary data file record. > > if i use this > gdb testexcept.exe info line *0x004015c3 You should be able to do this: echo "info line *0x004015c3" > gdb.txt gdb -batch --command=gdb.txt

bigger tenx :)

Best regards, Alexey Voytsehovich

Reply by email