Sign in Join

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

Mailing lists / fpc-pascal / 2003-08

Debugging FPC

17 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

James Mills

I think perhaps I need to repost my question as I saw the mailing list server go down yesterday...

Hi,

1) Is there anyway of finding out the cooresponding source line when a program crashes and only outputs the following:

An unhandled exception occurred at 0x080A33B1 :
List index exceeds bounds (-1)
0x080A33B1

2) With compile modes: -gg -gl
Aren't line info and tracebacks suppose to be shown, the above example does not show these.

cheers
James

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Jeff Pohlmeyer
With compile modes: -gg -gl Aren't line info and tracebacks suppose to be shown, the above example does not show these.

I think the problem comes with using exceptions. Normally, if a run-time error occurs, the default exit proc will print the line number info to stdout. But if an exception traps the error before the program exits, then that information is absorbed by the exception handler, and never makes it to the exit proc.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com

Reply by email

Peter Vreman
to Jeff Pohlmeyer
Show quoted text 9 lines
> With compile modes: -gg -gl > Aren't line info and tracebacks suppose to be shown, > the above example does not show these. I think the problem comes with using exceptions. Normally, if a run-time error occurs, the default exit proc will print the line number info to stdout. But if an exception traps the error before the program exits, then that information is absorbed by the exception handler, and never makes it to the exit proc.

The line info printing (-gl) does not use exitproc. It hooks an internal procvar that is used for printing backtraces.

Reply by email

James Mills
to Jeff Pohlmeyer: I think the problem comes with using exceptions. Normally, if a run-time error occurs,…
Jeff Pohlmeyer wrote 10 lines
> With compile modes: -gg -gl > Aren't line info and tracebacks suppose to be shown, > the above example does not show these. I think the problem comes with using exceptions. Normally, if a run-time error occurs, the default exit proc will print the line number info to stdout. But if an exception traps the error before the program exits, then that information is absorbed by the exception handler, and never makes it to the exit proc.

I do not have any exception handlers in my program though... So how does it not show the line number info ?

cheers
James

Show quoted text 11 lines
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

James Mills
to James Mills: I think perhaps I need to repost my question as I saw the mailing list server go down…
James Mills wrote 11 lines
I think perhaps I need to repost my question as I saw the mailing list server go down yesterday... Hi, 1) Is there anyway of finding out the cooresponding source line when a program crashes and only outputs the following: An unhandled exception occurred at 0x080A33B1 : List index exceeds bounds (-1) 0x080A33B1

Also anyone out there, I'd really like to know if the above is possible ... I have to find the source of this particular defect in 19,000 LOC. All it tells me is an index out of bounds, which could mean a number of things.

Thanks in advance

James

Show quoted text 19 lines
2) With compile modes: -gg -gl Aren't line info and tracebacks suppose to be shown, the above example does not show these. cheers James -- - -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Unknown author
to James Mills
James Mills wrote 8 lines
> An unhandled exception occurred at 0x080A33B1 : > List index exceeds bounds (-1) > 0x080A33B1 Also anyone out there, I'd really like to know if the above is possible ... I have to find the source of this particular defect in 19,000 LOC. All it tells me is an index out of bounds, which could mean a number of things.

Load the program in gdbpas. Put a breakpoint on HandleErrorFrame (with the command "b HANDLEERRORFRAME", caps are important). You can set command line parameters using "set args para1 para2 ...". If not all of the sources are in one directory, you can add directories that gdbpas has to search sources in using "directory dir1;dir2;dir3;...".

Next, type "run". When the breakpoint is hit, type "bt" (backtrace).

Jonas

Reply by email

James Mills
to Unknown author
Show quoted text 14 lines
On Fri, 22 Aug 2003, James Mills wrote: > > An unhandled exception occurred at 0x080A33B1 : > > List index exceeds bounds (-1) > > 0x080A33B1 > > Also anyone out there, I'd really like to know if the above is possible > ... I have to find the source of this particular defect in 19,000 LOC. > All it tells me is an index out of bounds, which could mean a number of > things. Load the program in gdbpas. Put a breakpoint on HandleErrorFrame (with the

what is gdbpas ? I'm using FPC 1.0.6 ...

cheers
James

Show quoted text 14 lines
command "b HANDLEERRORFRAME", caps are important). You can set command line parameters using "set args para1 para2 ...". If not all of the sources are in one directory, you can add directories that gdbpas has to search sources in using "directory dir1;dir2;dir3;...". Next, type "run". When the breakpoint is hit, type "bt" (backtrace). Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Unknown author
to James Mills
James Mills wrote
what is gdbpas ? I'm using FPC 1.0.6 ...

gdbpas is included with fpc (all versions). gdb = GNU DeBugger. The "pas" stands for "with pascal extensions".

Jonas

PS: please only quote the part of the original mail that's necessary to understand the context.

Reply by email

James Mills
to Unknown author
gdbpas is included with fpc (all versions). gdb = GNU DeBugger. The "pas" stands for "with pascal extensions".

I do not seem to have this anywhere on my system. Of course I have gdb. Can I get it somewhere ? (Perhaps the Debian maintainer didn't include it in 1.0.6)

PS: please only quote the part of the original mail that's necessary to understand the context.

nps, sorry, putting into practise now :)

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Unknown author
to James Mills
James Mills wrote 5 lines
> gdbpas is included with fpc (all versions). gdb = GNU DeBugger. The "pas" > stands for "with pascal extensions". I do not seem to have this anywhere on my system. Of course I have gdb. Can I get it somewhere ? (Perhaps the Debian maintainer didn't include it in 1.0.6)

gdb will work fine as well. gdbpas has just a bit more pascal support.

Jonas

Reply by email

Peter Vreman
to James Mills: I do not seem to have this anywhere on my system. Of course I have gdb. Can I get it…
Show quoted text 6 lines
> gdbpas is included with fpc (all versions). gdb = GNU DeBugger. The > "pas" > stands for "with pascal extensions". I do not seem to have this anywhere on my system. Of course I have gdb. Can I get it somewhere ? (Perhaps the Debian maintainer didn't include it in 1.0.6)

You can use the gdb available in Debian. It has already the pascal support included.

Reply by email

James Mills
to Peter Vreman
Peter Vreman wrote
You can use the gdb available in Debian. It has already the pascal support included.

(gdb) b HANDLEERRORFRAME
Function "HANDLEERRORFRAME" not defined.

It doesn't define whatever HANDLEERRORFRAME is though, so what Jonas said won't work...

cheers
James

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Peter Vreman
to James Mills
Show quoted text 9 lines
On Fri, Aug 22, 2003 at 03:14:20PM +0200, Peter Vreman wrote: > You can use the gdb available in Debian. It has already the pascal > support > included. (gdb) b HANDLEERRORFRAME Function "HANDLEERRORFRAME" not defined. It doesn't define whatever HANDLEERRORFRAME is though, so what Jonas said won't work...

Try FPC_BREAK_ERROR. It is a special symbol also used by the IDE.

Reply by email

Unknown author
to James Mills: (gdb) b HANDLEERRORFRAME Function "HANDLEERRORFRAME" not defined. It doesn't define…
James Mills wrote 5 lines
(gdb) b HANDLEERRORFRAME Function "HANDLEERRORFRAME" not defined. It doesn't define whatever HANDLEERRORFRAME is though, so what Jonas said won't work...

Of course, I forgot that the RTL we distribute doesn't contain symbol information. Go to the rtl/linux sources directory (I don't know offhand where the sources are installed under Linux), type "make OPT="-g", and then compile your program with -Fu<path_to_rtl_you_just_compiled>. Now it will link to an rtl with full debug information and you will be able to place breakpoints in the rtl.

Jonas

Reply by email

James Mills
to Unknown author
Show quoted text 6 lines
Of course, I forgot that the RTL we distribute doesn't contain symbol information. Go to the rtl/linux sources directory (I don't know offhand where the sources are installed under Linux), type "make OPT="-g", and then compile your program with -Fu<path_to_rtl_you_just_compiled>. Now it will link to an rtl with full debug information and you will be able to place breakpoints in the rtl.

Ahhhh, now all is clear to me! lol.
I'm using Debian (sarge) and the source is not distributed with the FPC packages.

It may look like I might have to remove all of FPC and compile and install the whole thing myself to get all the features I need ;) Any other Debian users on this mailing list with some advice ?

cheers
James

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email

Peter Vreman
to James Mills
Show quoted text 16 lines
On Fri, Aug 22, 2003 at 04:51:27PM +0200, wrote: > Of course, I forgot that the RTL we distribute doesn't contain symbol > information. Go to the rtl/linux sources directory (I don't know offhand > where the sources are installed under Linux), type "make OPT="-g", and > then compile your program with -Fu<path_to_rtl_you_just_compiled>. Now > it > will link to an rtl with full debug information and you will be able to > place breakpoints in the rtl. Ahhhh, now all is clear to me! lol. I'm using Debian (sarge) and the source is not distributed with the FPC packages. It may look like I might have to remove all of FPC and compile and install the whole thing myself to get all the features I need ;) Any other Debian users on this mailing list with some advice ?

You can leave the debian fpc packages installed and install an own compiled fpc version in /usr/local or in your home dir.

Reply by email

James Mills
to Peter Vreman
Peter Vreman wrote
You can leave the debian fpc packages installed and install an own compiled fpc version in /usr/local or in your home dir.

(hides from the maintainter), perhaps I should maintain the debian package :)

James (hides!)

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.

Reply by email