Recent

Author Topic: Problems using Dwarf 3 debugger [SOLVED]  (Read 2106 times)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Problems using Dwarf 3 debugger [SOLVED]
« on: October 18, 2024, 10:20:09 pm »
* Mac Mini M1
* macOS 14.6.1
* Lazarus 3.99 aarch64 (installed with fpcupdeluxe)
* FPC 3.3.1

I have an annoying problem trying to get Dwarf 3 debugging working with my app. The reason I'm using Dwarf 3 is that it's the only option that even lets me set a break point without it saying...
Code: Text  [Select][+][-]
  1. The debugger encountered an internal error.
  2. Save your work.
  3. You may the hit "Stop", or "Reset debugger" to terminate the debug session.
  4.  

With Dwarf 3, I can, at least single step through the code but the problem is that any watches I set just come up as <Error: >. This is both on component properties and simple primitives.



« Last Edit: October 18, 2024, 10:52:07 pm by carl_caulkett »
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #1 on: October 18, 2024, 10:29:39 pm »
@Martin_fr, I saw your message about applying a patch... https://forum.lazarus.freepascal.org/index.php/topic,65438.msg503217.html#msg503217

Is it worth me trying that?

UPDATE: Never mind! It look like that patch is already in place...
« Last Edit: October 18, 2024, 10:34:44 pm by carl_caulkett »
"It builds... ship it!"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12296
  • Debugger - SynEdit - and more
    • wiki
Re: Problems using Dwarf 3 debugger
« Reply #2 on: October 18, 2024, 10:32:12 pm »
Dwarf-3 is the debug info type. (The data that fpc writes for the debugger, so the debugger knows what the exe contains)

You probably use the "LLDB + FpDebug" debugger (backend) => Go to preferences, and then Debugger > Backend => At the top is a toolbar, and it should have a button that ends in "LLDB with FpDebug" (or very similar).

If it ends in just "LLDB (Alpha)" and does not mention FpDebug => then you want to change that.



If the above is correct. In the menu "View" > "Ide Internals" select "Debug Output". This opens an empty window. It is important you do that before starting the debugger (before F9 / Run).

Now Run your app in the debugger.
Then copy the content from that window.



If you have the LLDB+FpDebug then Dwarf-3 should be fine. (And get the better results)

Technically you should also be able to use Dwarf-2. How does the problem manifest, if you set a breakpoint with Dwarf-2?


It's in your post...

« Last Edit: October 18, 2024, 10:38:47 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12296
  • Debugger - SynEdit - and more
    • wiki
Re: Problems using Dwarf 3 debugger
« Reply #3 on: October 18, 2024, 10:36:29 pm »
That patch is already in 3.99 and fixes.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #4 on: October 18, 2024, 10:40:10 pm »
Dwarf-3 is the debug info type. (The data that fpc writes for the debugger, so the debugger knows what the exe contains)

You probably use the "LLDB + FpDebug" debugger (backend) => Go to preferences, and then Debugger > Backend => At the top is a toolbar, and it should have a button that ends in "LLDB with FpDebug" (or very similar).

If it ends in just "LLDB (Alpha)" and does not mention FpDebug => then you want to change that.



If the above is correct. In the menu "View" > "Ide Internals" select "Debug Output". This opens an empty window. It is important you do that before starting the debugger (before F9 / Run).

Now Run your app in the debugger.
Then copy the content from that window.



If you have the LLDB+FpDebug then Dwarf-3 should be fine. (And get the better results)

Technically you should also be able to use Dwarf-2. How does the problem manifest, if you set a breakpoint with Dwarf-2?


It's in your post...

This is all I can see in "Debugger backend"...
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #5 on: October 18, 2024, 10:51:38 pm »
It's in your post...

It didn't mention fpdebug!  I've changed it to...

Anyhow, your suggestion worked perfectly, unlike my app  ;)

Thanks for stepping in so quickly and solving the problem 😃🙏🏽
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #6 on: October 18, 2024, 10:56:10 pm »
Dwarf-3 is the debug info type. (The data that fpc writes for the debugger, so the debugger knows what the exe contains)

What do you mean by the curious term "exe"? I'm pretty sure we don't use them on Macs, though the word is bringing back a disturbing sense of deeply buried bad memories ;)
"It builds... ship it!"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12296
  • Debugger - SynEdit - and more
    • wiki
Re: Problems using Dwarf 3 debugger
« Reply #7 on: October 18, 2024, 10:56:22 pm »
What happens if you press the little down arrow behind the  "Alpha)]" ?

If there is no "... [LLDB debugger (with LLDB)]" in the list, press Add.  And then in the drop down below "Debugger type and path" select "LLDB debugger (with LLDB)"

As path enter the same path to lldb that you currently have, and then press ok.



The "LLDB alpha" is a very basic debugger, directly using lldb, with no pascal support. So it may not be able to evaluate all watches (it may expect C like syntax).


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12296
  • Debugger - SynEdit - and more
    • wiki
Re: Problems using Dwarf 3 debugger
« Reply #8 on: October 18, 2024, 10:59:27 pm »
Dwarf-3 is the debug info type. (The data that fpc writes for the debugger, so the debugger knows what the exe contains)

What do you mean by the curious term "exe"? I'm pretty sure we don't use them on Macs, though the word is bringing back a disturbing sense of deeply buried bad memories ;)

Just short for "the executable". You do have that on Mac. Somewhere deep inside the app bundle. A file containing machine code.

The debugger needs to know how to map addresses in that machine code (and the data that it has for variables), to files, lines, var-names and types. Otherwise the debugger can't tell you much.

The compiler provides all that. And in order for the the debugger to be able to read it, it must be in a known format. "DWARF" is the name of that format. It describes the encoding of the info. (just like the pdf spec describes how to encode a pdf).

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #9 on: October 18, 2024, 11:10:02 pm »
If there is no "... [LLDB debugger (with LLDB)]" in the list, press Add.  And then in the drop down below "Debugger type and path" select "LLDB debugger (with LLDB)"

i'm assuming you mean "LLDB debugger (with fpdebug)" ;)

That's what I selected and it seems to work :D

Thanks again, @Martin_fr!
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 654
Re: Problems using Dwarf 3 debugger
« Reply #10 on: October 18, 2024, 11:31:40 pm »
What do you mean by the curious term "exe"? I'm pretty sure we don't use them on Macs, though the word is bringing back a disturbing sense of deeply buried bad memories ;)

Just short for "the executable". You do have that on Mac. Somewhere deep inside the app bundle. A file containing machine code.

I was just indulging in a little humorous dig at Windows terminology. I was a Windows man since 3.0 and MSDOS before that, before switching to Mac in 2016. The first version of Windows I ever saw was v1.0.3. It'll never catch on, I said at the time  ;)
"It builds... ship it!"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12296
  • Debugger - SynEdit - and more
    • wiki
Re: Problems using Dwarf 3 debugger [SOLVED]
« Reply #11 on: October 18, 2024, 11:42:35 pm »
Well, I am a Win & Linux man...

And many things deter me from doing anything on Mac... Any key I press does something I don't expect...

But talking keys, so far no one was able to tell me how to switch a Mac to my favourite Keyboard layout. (well not that I tried too hard, nor that I could make use of it now...): Dvorak UK punctuation
Back when I did the main work on the lldb parts (on a Mac) => that would have really helped.

 

TinyPortal © 2005-2018