[Lazarus] IDE debug

Antonio Fortuny a.fortuny at sitasoftware.lu
Thu Apr 26 15:34:01 CEST 2012



Le 26/04/2012 14:30, Martin a écrit :
>
> GDB (used by lazarus) reports breakpoint "-20". The minus indicates, 
> it is a breakpoint internally handled by gdb (as opposed to a 
> breakpoint set by the IDE, at a location given by the IDE).
> GDB uses such breakpoints for single stepping.  A "pascal 
> instructions" spans over several asm instr. If the ide sends 
> "-step-over" (single step) the debugger finds all possible end 
> locations and set breakpoints (e.g. an if has 2 locations)
>
> So unfortunately the IDE has no influence on this breakpoint. It also 
> means it can neither be fixed, nor worked-around in the IDE. It might 
> be FPC or GDB.
>
> The only work around, is to open the asm window and use single 
> assembler step (you can also assign that do a key combo).
> Another work around is "run to cursor" (usually F4)
>
> If you upgraded, please ensure that the config point to the latest gdb 
> (7.3 should be installed / but you can load 7.4 from mingw)
>
> ----
> You specify "Lazarus 1.1 win32" So I assume you do run it on a 32 bit cpu?
Yes, Vista
> Or do you (perfectly ok) run 32bit code on a 64 bit cpu?
not yet but it is planned in a very near future
>
> Reason I ask is the address 0x726447b8.
> On 32 bit cpu, and unless you did anything special, your app would be 
> expected to be at addresses like 0x040####### or 0x041#######.
>
> So on 32 bit cpu this looks like it points to some loaded dll, or the 
> kernel itself.
>
> ----
> The first step is to make sure it is not a configuration issue. For 
> your project, and for any package that has debug info (any switch 
> containing -g...) ensure.
> - There is no optimization (except -O1)
Level 0
>    If you specify options in the build lazarus dialog, then use  -O-1
> - There is no smart linking (only needs to be checked in the project)
no
>
> ----
>    Question time ( I can not promise that this will lead to anything)
>
> Does the issue happen when stepping in a unit of your project? Or a 
> unit of a package?
in a project unit (with a TForm, the main form actually). But there is 
funny thing: after having step over (with breakpoints) some cxode of 
another unit (the code under the line wDBDef := TDataBaseDef.Create(1); 
) I recover the step-by-step debugging =-O    but I have to execute at 
least some code in another unit begore gdb records its walking path. 
Unfortunately this behaviour appears to be unpredictable and can happen 
anywhere in the code. Please note that with a FPCunit test application 
the recovery never happens
>
> Is it just on one or 2 lines, a block of lines, all lines of the unit, 
> several units?
one single line
> If only some lines. Are those lines enclosed by try-except/finally 
> blocks (nested try blocks)?
no, have a look at tne code below
>
> Do you compile with "stabs" (automatic) or " dwarf" (dwarf2 or 
> dwarf+sets / NEVER dwarf3) (see linking tab of project/package option)?
automatic
>
> What happens if you change this (project + package that contains the 
> unit in question)?
Nothing but as usual. Changing to another project (console application) 
debug, step debug and break points work OK. Coming back to this project, 
debugger does not work step by step again.
>
> Can you attach the source of the procedure in question (or at least 
> some lines of it) AND the assembler (from asm debug win) for the line 
> in question and at least the 2 surrounding lines?
... blablabla ...
procedure TForm1.*BtnOutLoadClick*(Sender: TObject);
var
   wDBDef: TDataBaseDef;
begin
   // simulate main thread execution to load the criteria
   wDBDef := TDataBaseDef.Create(1); <-------------------------- IDE 
break point
   try
     wDBDef.Separator := ';;';
     wDBDef.Definition := EOutDbDefinition.Lines.Text;
     Data.LoadDatabaseOutputCriteria(wDBDef);
     Data.FilesDir := 'D:\Synchro\Logs';
     Data.FilesDir2 := EmptyStr;
     Data.FDBThreadPriority := tpNormal;
     Data.FDBThreadLoopDelay := 1000;
   finally
     FreeAndNil(wDBDef)
   end;
end;

procedure TForm1.*BtnInLoadClick(*Sender: TObject);
begin
... blablabla ...

>
> If you open the assembler win, it has an edit/input on top. Enter the 
> address. Does it show any info (that is any function name)?
ASM:
TFORM1__*BTNOUTLOADCLICK*
00427BD0 55                       push   %ebp
00427BD1 89e5                     mov    %esp,%ebp
00427BD3 83ec68                   sub    $0x68,%esp
00427BD6 895d98                   mov    %ebx,-0x68(%ebp)
00427BD9 89759c                   mov    %esi,-0x64(%ebp)
00427BDC 8945f8                   mov    %eax,-0x8(%ebp)
00427BDF 8955fc                   mov    %edx,-0x4(%ebp)
00427BE2 c745a000000000           movl   $0x0,-0x60(%ebp)
00427BE9 8d4de8                   lea    -0x18(%ebp),%ecx
00427BEC 8d55d0                   lea    -0x30(%ebp),%edx
00427BEF b801000000               mov    $0x1,%eax
00427BF4 e88740feff               call   0x40bc80 <fpc_pushexceptaddr>
00427BF9 e8c261feff               call   0x40ddc0 <fpc_setjmp>
00427BFE 50                       push   %eax
00427BFF 85c0                     test   %eax,%eax
00427C01 0f8514010000             jne    0x427d1b 
<TFORM1__BTNOUTLOADCLICK+331>
00427C07 baf0716300               mov    $0x6371f0,%edx
00427C0C b901000000               mov    $0x1,%ecx
00427C11 b800000000               mov    $0x0,%eax
00427C16 e855160000               call   0x429270 <TDATABASEDEF__CREATE>
00427C1B 8945f4                   mov    %eax,-0xc(%ebp)
00427C1E 8d4dc0                   lea    -0x40(%ebp),%ecx
00427C21 8d55a8                   lea    -0x58(%ebp),%edx
00427C24 b801000000               mov    $0x1,%eax
00427C29 e85240feff               call   0x40bc80 <fpc_pushexceptaddr>
00427C2E e88d61feff               call   0x40ddc0 <fpc_setjmp>
00427C33 50                       push   %eax
00427C34 85c0                     test   %eax,%eax
00427C36 0f85c3000000             jne    0x427cff 
<TFORM1__BTNOUTLOADCLICK+303>
00427C3C bef86a6300               mov    $0x636af8,%esi
00427C41 8b5df4                   mov    -0xc(%ebp),%ebx
00427C44 8d4320                   lea    0x20(%ebx),%eax
00427C47 e804c2fdff               call   0x403e50 <fpc_ansistr_decr_ref>
00427C4C 897320                   mov    %esi,0x20(%ebx)
00427C4F 8d45a0                   lea    -0x60(%ebp),%eax
00427C52 e8f9c1fdff               call   0x403e50 <fpc_ansistr_decr_ref>
00427C57 c745a000000000           movl   $0x0,-0x60(%ebp)
00427C5E 8b45f8                   mov    -0x8(%ebp),%eax
00427C61 8b80a4040000             mov    0x4a4(%eax),%eax
00427C67 8b8078030000             mov    0x378(%eax),%eax
00427C6D 8d55a0                   lea    -0x60(%ebp),%edx
00427C70 8b4df8                   mov    -0x8(%ebp),%ecx
00427C73 8b89a4040000             mov    0x4a4(%ecx),%ecx
00427C79 8b8978030000             mov    0x378(%ecx),%ecx
00427C7F 8b09                     mov    (%ecx),%ecx
00427C81 ff9188000000             call   *0x88(%ecx)
00427C87 8b55a0                   mov    -0x60(%ebp),%edx
00427C8A 8b45f4                   mov    -0xc(%ebp),%eax
00427C8D e88e180000               call   0x429520 
<TDATABASEDEF__SETDEFINITION>
00427C92 8b45f8                   mov    -0x8(%ebp),%eax
00427C95 8b80b4040000             mov    0x4b4(%eax),%eax
00427C9B 8b55f4                   mov    -0xc(%ebp),%edx
00427C9E e87d240000               call   0x42a120 
<TSYNCFLATLOADMAINTHREADDATA__LOADDATABASEOUTPUTCRITERIA>
00427CA3 bb046b6300               mov    $0x636b04,%ebx
00427CA8 8b45f8                   mov    -0x8(%ebp),%eax
00427CAB 8bb0b4040000             mov    0x4b4(%eax),%esi
00427CB1 8d465c                   lea    0x5c(%esi),%eax
00427CB4 e897c1fdff               call   0x403e50 <fpc_ansistr_decr_ref>
00427CB9 895e5c                   mov    %ebx,0x5c(%esi)
00427CBC a1d0946300               mov    0x6394d0,%eax
00427CC1 e81af8fdff               call   0x4074e0 <fpc_ansistr_incr_ref>
00427CC6 8b45f8                   mov    -0x8(%ebp),%eax
00427CC9 8b98b4040000             mov    0x4b4(%eax),%ebx
00427CCF 8d4360                   lea    0x60(%ebx),%eax
00427CD2 e879c1fdff               call   0x403e50 <fpc_ansistr_decr_ref>
00427CD7 a1d0946300               mov    0x6394d0,%eax
00427CDC 894360                   mov    %eax,0x60(%ebx)
00427CDF 8b                       mov    -0x8(%ebp),%eax
00427CE2 8b80b4040000             mov    0x4b4(%eax),%eax
00427CE8 c7405003000000           movl   $0x3,0x50(%eax)
00427CEF 8b45f8                   mov    -0x8(%ebp),%eax
00427CF2 8b80b4040000             mov    0x4b4(%eax),%eax
00427CF8 c74054e8030000           movl   $0x3e8,0x54(%eax)
00427CFF e84c42feff               call   0x40bf50 <fpc_popaddrstack>
00427D04 8d45f4                   lea    -0xc(%ebp),%eax
00427D07 e854dd0000               call   0x435a60 
<SYSUTILS_FREEANDNIL$formal>
00427D0C 58                       pop    %eax
00427D0D 85c0                     test   %eax,%eax
00427D0F 740a                     je     0x427d1b 
<TFORM1__BTNOUTLOADCLICK+331>
00427D11 48                       dec    %eax
00427D12 85c0                     test   %eax,%eax
00427D14 74                       je     0x427d16 
<TFORM1__BTNOUTLOADCLICK+326>
00427D16 e8a543feff               call   0x40c0c0 <fpc_reraise>
00427D1B e83042feff               call   0x40bf50 <fpc_popaddrstack>
00427D20 8d45a0                   lea    -0x60(%ebp),%eax
00427D23 e828c1fdff               call   0x403e50 <fpc_ansistr_decr_ref>
00427D28 c745a000000000           movl   $0x0,-0x60(%ebp)
00427D2F 58                       pop    %eax
00427D30 85c0                     test   %eax,%eax
00427D32 7405                     je     0x427d39 
<TFORM1__BTNOUTLOADCLICK+361>
00427D34 e88743feff               call   0x40c0c0 <fpc_reraise>
00427D39 8b5d98                   mov    -0x68(%ebp),%ebx
00427D3C 8b759c                   mov    -0x64(%ebp),%esi
00427D3F c9                       leave
00427D40 c3                       ret
00427D41 0000                     add    %al,(%eax)
00427D43 0000                     add    %al,(%eax)
00427D45 0000                     add    %al,(%eax)
00427D47 0000                     add    %al,(%eax)
00427D49 0000                     add    %al,(%eax)
00427D4B 0000                     add    %al,(%eax)
00427D4D 0000                     add    %al,(%eax)
00427D4F 00                       add    %dl,-0x77(%ebp)
TFORM1__*BTNINLOADCLICK
*... blablabla ...

at address 0x726447b8 seems rubbish

00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
72644518 <error>
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......
00000000 ......

>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120426/5c8aa044/attachment-0003.html>


More information about the Lazarus mailing list