[fpc-devel] New Windows gdb-binary

Martin lazarus at mfriebe.de
Sat Oct 1 02:05:48 CEST 2011


On 30/09/2011 23:23, Martin wrote:
> On 30/09/2011 14:02, Joost van der Sluis wrote:
>> Please test this gdb-version, and tell me about your experiences.
>> Especially Martin. ;)
>>
>> Oh, you can download it here:
>> http://www.lazarussupport.com/gdb_lazarssupport_20110930.zip
>>
>>
>
> It crashes when -Xe (external linker) was used. Also crashes with 
> stabs...
>
> I am not 100% sure, but it appears to choke on
> -data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC

Ok, seems to have big issues with strings in fields.

Run the ExceptionPrg from  debugger\test\Gdbmi\TestApps\ExceptPrg.lpr in 
lazarus.
On hitting the breakpoint in fpc_raise_exception:

 >> TCmdLineDebugger.SendCmdLn "x/s Exception($eax).FMessage"
<< TCmdLineDebugger.ReadLn "&"x/s Exception($eax).FMessage\n""
<< TCmdLineDebugger.ReadLn "&"Cannot resolve DW_OP_push_object_address 
for a missing object\n""

if you keep the session running, and set the stackframe to 
fpc_raise_exception (the IDE will have lowered it), then you can send 
the following commands:

<p Exception($eax)>
&"p Exception($eax)\n"
~"$2 = (^Exception = class ) 0x78660\n"
^done
(gdb)
<p Exception($eax)^>
&"p Exception($eax)^\n"
~"$3 = {<TObject> = {_vptr$TOBJECT = 0x415018}, fmessage = 'abc'"
~", fhelpcontext = 0"
~", HelpContext = 0"
~", Message = 'abc'"
~"}"
~"\n"
^done
(gdb)
<p Exception($eax).Message>
&"p Exception($eax).Message\n"
&"Cannot access memory at address 0x636260ff\n"
^error,msg="Cannot access memory at address 0x636260ff"
(gdb)
<p Exception($eax).FMessage>
&"p Exception($eax).FMessage\n"
&"Cannot access memory at address 0x636260ff\n"
^error,msg="Cannot access memory at address 0x636260ff"
(gdb)
<p Exception($eax)^.FMessage>
&"p Exception($eax)^.FMessage\n"
&"Cannot access memory at address 0x636260ff\n"
^error,msg="Cannot access memory at address 0x636260ff"
(gdb)



--------------------------------------------------------------

In an other attempt, using this program:

program Project1;

{$mode objfpc}{$H+}
type
   TFoo=class
   private
     FText:string;
   end;

var
   a: TFoo;

begin
   a := TFoo.Create;
   a.FText := 'abcde';
   writeln(1);
   readln;
end.

sending to the debugger (without the <>)

<p a>
&"p a\n"
~"$1 = 0x107488\n"
^done
(gdb)
<p a^>
&"p a^\n"
~"$2 = {<TObject> = {_vptr$TOBJECT = 0x40e018}, FText = 'abcde'"
~"}"
~"\n"
^done
(gdb)
<p a.FText>
&"p a.FText\n"
~"$3 = 'abcde'"
~"\n"

the text is correct => but gdb crashes at this point.




More information about the fpc-devel mailing list