Debugging in WIN32 on NT4
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
After pressing F8, with this program as the primary file:
+-[¦]--------------------- G:\Ymir\Colonist\Catan.pas ------
¦program Catan;
¦
¦uses Sysutils, Colonist;
¦
¦begin
¦ try
¦ writeln ('Start: +-[¦]------------------------------+
¦ game := TGame.cre¦ ¦
¦ writeln ('Trying ¦ Error within GDB ¦
¦ game.CreateGame('¦ Error code = 0 ¦
¦ writeln ('Game ob¦ ¦
¦ game.savegame ('e¦ Ok _ ¦
¦ writeln ('Game ob¦ ¯¯¯¯¯¯¯¯ ¦
¦ game.free; +----------------------------------+
¦ except
¦ on e : exception do
¦ writeln ('Exception: ', e.message);
¦ end;
¦end.
¦
Tried again, in several steps:
When Opening the GDB window, the following occurs:
¦cd g:/Ymir
¦Working directory //g/Ymir.
¦set args
¦b FPC_BREAK_ERROR
¦No symbol table is loaded. Use the "file" command.
When opening a file in the IDE and setting a breakpoint, I get
in the GDB window:
¦break catan.pas:7
¦No symbol table is loaded. Use the "file" command.
¦Undefined command: "No". Try "help".
I used the file command in GDB window:
¦gdb>file g:\ymir\colonist\catan.exe
¦g:ymircolonistcatan.exe: No such file or directory.
¦gdb>file g:/ymir/colonist/catan.exe
¦gdb>
Note that I need to use slash (/) instead of backslash, as is normal
on WIN32 and GO32v2 platforms
{ remark:
Adding a breakpoint does not change the color of the line.
It is shown in the right color when restarting the IDE with the
breakpoint in the list.
}
¦break catan.pas:7
¦Breakpoint 1 at 0x40a490: file catan.pas, line 7.
¦cond 1
¦Breakpoint 1 now unconditional.
¦set new-console off
Running the program. GDB messages when the breakpoint is reached:
¦run
¦Starting program: g:/ymir/colonist/catan.exe
¦77f00000:C:/WINNT/system32/kernel32.dll
¦77e70000:C:/WINNT/system32/user32.dll
¦77ed0000:C:/WINNT/system32/GDI32.dll
¦77dc0000:C:/WINNT/system32/ADVAPI32.dll
¦77e10000:C:/WINNT/system32/RPCRT4.dll
¦
¦Program received signal SIGSEGV, Segmentation fault.
¦0x77f0d3e8 in ?? ()
Asking the next statement gives the next error in the GDB window
and the same message as before: Error in GDB, Error code = 0.
¦next
¦Cannot find bounds of current function
When I do all these thing manually in gdbpasw.exe, they work correctly
(as far as I can see). There I can use next after stopping at a breakpoint.
----- This is a copy of that session:
GNU gdb 4.18.pas.b1 modified for Pascal language support
Copyright 1998 Free Software Foundation, Inc.
Pascal modifications by Pierre Muller and Peter Vreman
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 "i586-pc-cygwin32".
(gdbpas) cd g:/ymir
Working directory g:/ymir
(canonically //g/ymir).
(gdbpas) set args
(gdbpas) b FPC_BREAK_ERROR
No symbol table is loaded. Use the "file" command.
(gdbpas) file colonist/catan.exe
Reading symbols from colonist/catan.exe...done.
(gdbpas) break catan.pas:7
Breakpoint 1 at $40a490: file catan.pas, line 7.
(gdbpas) cond 1
Breakpoint 1 now unconditional.
(gdbpas) run
Starting program: g:/ymir/colonist/catan.exe
77f00000:C:/WINNT/system32/kernel32.dll"C:/WINNT/system32/kernel32.dll": error r
eading line numbers
77e70000:C:/WINNT/system32/user32.dll
77ed0000:C:/WINNT/system32/GDI32.dll
77dc0000:C:/WINNT/system32/ADVAPI32.dll"C:/WINNT/system32/ADVAPI32.dll": error r
eading line numbers
77e10000:C:/WINNT/system32/RPCRT4.dll
Writing debug info.
Breakpoint 1, main () at catan.pas:7
7 catan.pas: No such file or directory.
(gdbpas) next
Start: create game object
8 in catan.pas
----------------------------
Sidenote: I get a lot of messages between ¦ when using the debugging
functions, placed on the screen over other text. When refreshing the window,
they disapear. For example, a piece of the editor window:
¦ game := TGame.create;
¦|breakpoints_changed|to create a
|breakpoints_changed|'catan.ini');
|breakpoints_changed|bject saves i
|breakpoints_changed|eerste.col');
¦ writeln ('Game objects frees'
¦ game.free;
¦|error begin|
|end of error begin|n do
¦ writeln ('Exception: ', e.m
Here is the output of the GDB window when I :
Closed the IDE. (breakpoints still existing)
Reopend the IDE. (breakpoints get there correct color)
Compiled the program.
Opened the debug window.
GDB still has an error on the "b FPC_BREAK_ERROR" command
¦cd g:/Ymir
¦Working directory //g/Ymir.|frames_invalid|
¦file //g/ymir/colonist/catan.exe
¦Reading symbols from //g/ymir/colonist/catan.exe...done.
¦set args|error begin|
|b FPC_BREAK_ERROR
¦Function "FPC_BREAK_ERROR" not defined.|breakpoints_changed|
¦break catan.pas:7
¦Breakpoint 1 at 0x40a490: file catan.pas, line 7.|breakpoints_changed|
¦cond 1
¦Breakpoint 1 now unconditional.|breakpoints_changed|
¦break catan.pas:9
¦Breakpoint 2 at 0x40a4d3: file catan.pas, line 9.|breakpoints_changed|
¦cond 2
¦Breakpoint 2 now unconditional.
I'm working on a NT4 with WIN32 snapshot of 21/11/2000 (compiler 1.0.3, GDB 5.0)
Additional information:
Reporter: Luk Vandelaer
EMail: luk dot vandelaer at wisa dot be
Mantis conversion info:
- Mantis ID: 3292
- OS: WIN32
- Version: ?
- Fixed in version: 1.0.5