New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Progress made with Lazarus/Free Pascal + Native Debug #118
Comments
can you send me some source that is as minimal as possible to replicate the problem? |
Hi Jan, thanks for the reply.
I’ve uploaded a sample app to https://dropfile.to/mpZpcbp access code is D51wjvO.
It’s a simple console app with a simplified but similar structure to the app I’m working on at the moment.
Try putting a breakpoint in the Pascal source file uwebfreak.pas
Cheers,
Carl
…On 26 Jul 2017, 19:39 +0100, Jan Jurzitza ***@***.***>, wrote:
can you send me some source that is as minimal as possible to replicate the problem?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Could you provide me with build instructions? I tried
|
Give me a few minutes. I built it from within Lazarus itself with no special parameters, but I’ll try and see what are the correct parameters for using Lazbuild...
…On 26 Jul 2017, 21:09 +0100, Jan Jurzitza ***@***.***>, wrote:
Could you provide me with build instructions?
I tried lazbuild webfreak.lpi but it errored:
Error: (lazarus) invalid Lazarus directory "": directory lcl not found
Error: (lazarus) Building failed: webfreak.lpi
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I do have the following environment variables set:
# Lazarus stuff
export PP=/usr/local/bin/fpc
export FPCDIR=/usr/local/share/fpcsrc
export LAZARUSDIR=/Developer/lazarus
export FPCTARGET=i386-darwin
export FPCTARGETCPU=i386
The paths are based on standard default installations of Lazarus.
I don’t know if Lazbuild uses them or not...
…On 26 Jul 2017, 21:16 +0100, Carl Caulkett ***@***.***>, wrote:
Give me a few minutes. I built it from within Lazarus itself with no special parameters, but I’ll try and see what are the correct parameters for using Lazbuild...
On 26 Jul 2017, 21:09 +0100, Jan Jurzitza ***@***.***>, wrote:
> Could you provide me with build instructions?
> I tried lazbuild webfreak.lpi but it errored:
>
> Error: (lazarus) invalid Lazarus directory "": directory lcl not found
> Error: (lazarus) Building failed: webfreak.lpi
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
|
Do you have the full Lazarus installed or just Free Pascal?
…On 26 Jul 2017, 21:24 +0100, Carl Caulkett ***@***.***>, wrote:
I do have the following environment variables set:
# Lazarus stuff
export PP=/usr/local/bin/fpc
export FPCDIR=/usr/local/share/fpcsrc
export LAZARUSDIR=/Developer/lazarus
export FPCTARGET=i386-darwin
export FPCTARGETCPU=i386
The paths are based on standard default installations of Lazarus.
I don’t know if Lazbuild uses them or not...
On 26 Jul 2017, 21:16 +0100, Carl Caulkett ***@***.***>, wrote:
> Give me a few minutes. I built it from within Lazarus itself with no special parameters, but I’ll try and see what are the correct parameters for using Lazbuild...
>
> On 26 Jul 2017, 21:09 +0100, Jan Jurzitza ***@***.***>, wrote:
> > Could you provide me with build instructions?
> > I tried lazbuild webfreak.lpi but it errored:
> >
> > Error: (lazarus) invalid Lazarus directory "": directory lcl not found
> > Error: (lazarus) Building failed: webfreak.lpi
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub, or mute the thread.
|
both, are you sure the lpi file is correct? It references |
That lip should have compiled, but I have removed the lcl dependency.
Try this…
https://dropfile.to/EjVxCW9 access key: fSNzkRg
…On 26 Jul 2017, 21:36 +0100, Jan Jurzitza ***@***.***>, wrote:
both, are you sure the lpi file is correct? It references <PackageName Value="LCL"/> and stuff
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I’m sorry to mess you around. I do appreciate the effort you are taking over this!
…On 26 Jul 2017, 21:44 +0100, Carl Caulkett ***@***.***>, wrote:
That lip should have compiled, but I have removed the lcl dependency.
Try this…
https://dropfile.to/EjVxCW9 access key: fSNzkRg
On 26 Jul 2017, 21:36 +0100, Jan Jurzitza ***@***.***>, wrote:
> both, are you sure the lpi file is correct? It references <PackageName Value="LCL"/> and stuff
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
|
what's your build procedure, I haven't setup anything yet, I just installed lazarus and fpc from the arch repositories |
Did you start Lazarus so far? AFAIK it's doing some configuration on first start up. |
uhh I didn't install any gui with it yet, but I can get the gui for lazarus and try that |
I installed Lazarus/Free Pascal by this procedure:
From this page https://sourceforge.net/projects/lazarus/files/Lazarus%20Mac%20OS%20X%20i386/Lazarus%201.8.0RC3/
Download
fpc-3.0.2.intel-macosx.dmg
fpc-src-3.0.2-macosx.dmg
lazarus-1.8.0-RC3-i686-macosx.dmg
Very important. Install the above disk images in the above sequence.
That should give you an environment capable of building any standard Lazarus app, such as the one I sent.
…On 26 Jul 2017, 21:49 +0100, Jan Jurzitza ***@***.***>, wrote:
what's your build procedure, I haven't setup anything yet, I just installed lazarus and fpc from the arch repositories
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
ok I managed to build it and I can reproduce crashes now when trying to expand the variable, I will try to find out the reason. |
This seems like an lldb issue to me
|
As I mentioned, though, on my system, if I run Xcode with LLDB, I can access the variables, It’s only with Native Debug with LLDB that I’m having problems. That’s what was shown in the screen shots I initially sent.
…On 26 Jul 2017, 22:14 +0100, Jan Jurzitza ***@***.***>, wrote:
This seems like an lldb issue to me
(lldb) breakpoint set -f uwebfreak.pas -l 51
Breakpoint 1: where = webfreak`RUNWEBFREAK + 180 at uwebfreak.pas:51, address = 0x00000000004724e4
(lldb) run
Process 1755 launched: './webfreak' (x86_64)
Process 1755 stopped
* thread #1, name = 'webfreak', stop reason = breakpoint 1.1
frame #0: webfreak`RUNWEBFREAK(this=0x00007ffff7fa3100) at uwebfreak.pas:51
48 List := TStringList.Create;
49 try
50 for I := 0 to 99 do
-> 51 List.Add(IntToStr(I));
52 writeLn(List.Text);
53 finally
54 List.Free;
(lldb) bt
* thread #1, name = 'webfreak', stop reason = breakpoint 1.1
* frame #0: webfreak`RUNWEBFREAK(this=0x00007ffff7fa3100) at uwebfreak.pas:51
frame #1: webfreak`RUN(this=0x00007ffff7fa3100) at uwebfreak.pas:30
frame #2: webfreak`main at webfreak.lpr:15
frame #3: 0x000000000040018c webfreak`_start + 64
(lldb) print LIST
error: need to add support for DW_TAG_base_type 'FormalDef' encoded with DW_ATE = 0x7, bit_size = 0
error: need to add support for DW_TAG_base_type 'EXTENDED' encoded with DW_ATE = 0x4, bit_size = 80
Stack dump:
0. HandleCommand(command = "print LIST")
1. <eof> parser at end of file
2. Parse:41:16: Generating code for declaration 'TWEBFREAK::$__lldb_expr'
fish: “lldb ./webfreak” terminated by signal SIGSEGV (Address boundary error)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
well I used lldb without any extension or code in between there, and if I can't get the command line debugger to work I won't be able to fix an extension using it. I am using |
Maybe Xcode is using undocumented means of accessing the information then. Which would be a shame, but never mind. Just out of interest, where did you get `lldb version 4.0.1` from?
…On 26 Jul 2017, 22:28 +0100, Jan Jurzitza ***@***.***>, wrote:
well I used lldb without any extension or code in between there, and if I can't get the command line debugger to work I won't be able to fix an extension using it. I am using lldb version 4.0.1 which should be newer than your version there.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
I think I have misunderstood something. I didn't realise that you were doing everything on ArchLinux. That would explain why you couldn't run Xcode! I hope you don't regard this as "the typical arrogance of the Apple Mac user" !! |
When you set the breakpoint in LLDB, did you try doing `print *LIST' ? Like I said, Lazarus and Delphi do some dereferencing tricks to make variables which should appear as *[varname] actually appear as [varname]. LLDB doesn't understand this, so you have to speak in real "pointer" terms to it. |
Hi Jan, if you have a moment, grab the latest version of the sample app at https://dropfile.to/cYpBezD access code Evzwk2x. Stick a break point in LLDB at line 69, then do 'p *OBJ.LIST`. You should see the contents of the List object which is a child property of the Obj object. In other words, LLDB does allow the display of child properties. Interestingly, I've just tried this via the Add Watch facility in VSCode and it seems to work here. It didn't seem to work in the actual app I'm working on, though. So what would be good is if the list of Variables was able to detect which of the variables was a class reference, and to ask LLDB for the * value, so that we don't have to add the values manually as watches. I hope that all makes sense. Cheers, |
Jan, something bad has happened! I no longer am able to stop at breakpoints at all. I've tried uninstalling and reinstalling Native Debug, but I cannot get breakpoints to work at all. This rather blows my progress out of the water. Do you have any idea what the problem might be? |
have you tried using a different compiler or different arguments to emit gdb compatible debug symbols? |
No, I haven't done anything differently, as far as I know. It just stopped working suddenly. |
It hasn't worked since last night. Something has happened overnight to cause me to lose the use of breakpoints. |
It's OK my LLDB is working again. Not sure what the problem was, to be honest. |
Any thoughts about the |
I was trying to get LLDB to work with Free Pascal and found this thread. On my system (10.13 lldb-900.0.45) the "p" command is broken and crashing but "fr v" works and displays members variables of classes. Look at this example and notice how "p" crashes at the end but I get member variables using fr v. Not sure if this is relevant or helps.
|
@carlca @genericptr Any update on this? Could you possibly retry that, maybe with an updated LLDB and also with GDB? |
lldb --version: lldb-370.0.42 -
Hello, further to my post a couple of months ago #106 , I have tried again with Native Pascal, and have managed to get further this time.
I'm not seeing the flurry of error messages in the debug console so that's good. I am, however, still having problems accessing variables. As you can see from the screenshot below, I have, for example, a variable called Code. This is an instance of the TCodeBuffer class. The default entry in the variable list doesn't work because Lazarus/FPC does a dereferencing trick to make the true value of
*Code
appear asCode
in the code. If however, I add a watch with the variable specified as*CODE
then I get to see the variables class name displayed. It also successfully displays simple class members, such as strings, numbers and booleans.The second screen shot shows the Xcode application working with LLDB to debug the same Lazarus/FPC application. My logic is that if Xcode can do it, then it must be theoretically possible for Native Debug to do the same thing. I'm not suggesting it's easy, just theoretically possible!
Why not just use Xcode, you may ask. Well, VSCode is a much more pleasant application to use compare to Xcode, IMO.
I know you said you don't have any FPC/Lazarus/Pascal experience but hopefully, I've been able to supply a little more useful information this time.
To recap then, can you help me uncover more of LLDB's hidden variable information?
Thanks in advance,
Carl
The text was updated successfully, but these errors were encountered: