Sign in Join

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

Mailing lists / fpc-pascal / 2014-09

console gdb in mac

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

I'm trying to debug lcl-cocoa, but the debugger in the IDE is not helping (not stopping in breakpoints inside the LCL, can't read variable names, etc...)

So I moved to the console gdb, and I can already break, step over, etc.

But, how to read variable names? I guess a wierd mangling will be involved here =)

In particular, let's say I am here:

procedure TControl.SetParent(NewParent: TWinControl);
begin
  if FParent = NewParent then exit; <<--- here

How can I read the value of field FParent which is located in object "Self" ?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
I'm trying to debug lcl-cocoa, but the debugger in the IDE is not helping (not stopping in breakpoints inside the LCL, can't read variable names, etc...)

Well, I see now that IDE debugging generally works, but that reliably it stops working inside this function:

function TCocoaWidgetSet.SetFocus(Handle: HWND): HWND;

Breakpoint inside it works, but stepping / viewing values / any other action will crash gdb.

Anyway, I'd still like to know the answer to my original question, if anyone knows =)

thanks,

Felipe Monteiro de Carvalho

Reply by email

Joost van der Sluis
to Felipe Monteiro de Carvalho: I'm trying to debug lcl-cocoa, but the debugger in the IDE is not helping (not stopping…
Felipe Monteiro de Carvalho wrote 18 lines
Hello, I'm trying to debug lcl-cocoa, but the debugger in the IDE is not helping (not stopping in breakpoints inside the LCL, can't read variable names, etc...) So I moved to the console gdb, and I can already break, step over, etc. But, how to read variable names? I guess a wierd mangling will be involved here =) In particular, let's say I am here: procedure TControl.SetParent(NewParent: TWinControl); begin if FParent = NewParent then exit; <<--- here How can I read the value of field FParent which is located in object "Self" ?

That's not that difficult:

p this
p this.fparent

If it does not work, try 'THIS' and 'THIS.FPARENT'.

Joost.

Reply by email

Joost van der Sluis
to Felipe Monteiro de Carvalho: On Sun, Sep 7, 2014 at 5:19 PM, Felipe Monteiro de Carvalho Well, I see now that IDE…
Felipe Monteiro de Carvalho wrote 13 lines
On Sun, Sep 7, 2014 at 5:19 PM, Felipe Monteiro de Carvalho wrote: > I'm trying to debug lcl-cocoa, but the debugger in the IDE is not > helping (not stopping in breakpoints inside the LCL, can't read > variable names, etc...) Well, I see now that IDE debugging generally works, but that reliably it stops working inside this function: function TCocoaWidgetSet.SetFocus(Handle: HWND): HWND; Breakpoint inside it works, but stepping / viewing values / any other action will crash gdb.

Well, it was when I was working on Lazarus's cocoa-widgetset that I decided to make my own debugger.

You can try that one. Only thing is that you have to sign your IDE. (Or fpd - the console version of the debugger), you have to use the Dwarf debug-format, and you have to run 'dsymutil' to create a .dSym-debug bundle for your application.

If you want I can help you with that.

regards,

Joost.

Reply by email

Michael Ring
to Joost van der Sluis

Joost, I saw some of your posts but did not know that your debugger has a console version. Is it possible to connect to a gdb-server with fpd?

Michael (not trying to hijack this thread....)

Joost van der Sluis wrote 31 lines
On 09/07/2014 05:42 PM, Felipe Monteiro de Carvalho wrote: > On Sun, Sep 7, 2014 at 5:19 PM, Felipe Monteiro de Carvalho > wrote: >> I'm trying to debug lcl-cocoa, but the debugger in the IDE is not >> helping (not stopping in breakpoints inside the LCL, can't read >> variable names, etc...) > > Well, I see now that IDE debugging generally works, but that reliably > it stops working inside this function: > > function TCocoaWidgetSet.SetFocus(Handle: HWND): HWND; > > Breakpoint inside it works, but stepping / viewing values / any other > action will crash gdb. Well, it was when I was working on Lazarus's cocoa-widgetset that I decided to make my own debugger. You can try that one. Only thing is that you have to sign your IDE. (Or fpd - the console version of the debugger), you have to use the Dwarf debug-format, and you have to run 'dsymutil' to create a .dSym-debug bundle for your application. If you want I can help you with that. regards, Joost. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Joost van der Sluis
to Michael Ring
Michael Ring wrote
Joost, I saw some of your posts but did not know that your debugger has a console version. Is it possible to connect to a gdb-server with fpd? Michael (not trying to hijack this thread....)

No, it has nothing to do with gdb. In principle it would be possible to build something like a fpd-server. And maybe I will do that, because it would remove the dependency to sign the Lazarus IDE after each rebuild. (In that case, fpd-server is signed, and Lazarus just connects to it)

But my guess is that you want to use it on x86 hardware. For now it only works with x86/x86_64.

The console version (components/fpdebug/app.fpd) is only there to ease debugging of the debugger. But it's function-complete, simply because each function is first developed in the console-version, because that's easier to debug)

Joost.

Reply by email

Jonas Maebe
to Joost van der Sluis: That's not that difficult: p this p this.fparent If it does not work, try 'THIS' and…
Joost van der Sluis wrote 8 lines
On 09/07/2014 05:19 PM, Felipe Monteiro de Carvalho wrote: > How can I read the value of field FParent which is located in object > "Self" ? That's not that difficult: p this p this.fparent

You can also use "self". You don't even have to add self/this explicitly, and just use "p fparent". Additionally, to print all fields of a class instance, you have to use "p self^", as class instances are pointers.

Jonas

Reply by email