Open carlca opened 7 years ago
The dropdown should only appear if there is no debug configuration. Did you open /Users/carl/Code/fpc/codepreview
in vscode and select Debug
(the name you gave it) in the dropdown in the debug sidebar before hitting play?
Aha! My mistake was not selecting the entire folder. I have done that and now I can set breakpoints and run the executable, so that's good. There is still a problem in that I don't seem to be able to evaluate variables, either locally declared ones or class members.
I'm also getting lots of repeated error messages in the debug console such as:
CarbonFontIDToFontName Error: ATSUFindFontName Length failed with result -8905
The error messages, I'm not so concerned about, that's just a minor irritation. The lack of ability to inspect variables, especially the class members is a lot more serious. If we can get past this problem, suddenly VSCode and Code-Debug become essential tools for Lazarus development on the Mac!
I'm also seeing lots of messages like this:
undefinederror: 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
error: main.o {0x0003e057}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
error: main.o {0x0003e057}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
error: main.o {0x0003f695}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
error: main.o {0x0003f695}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
error: main.o {0x0003f695}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
error: main.o {0x0003f695}: unhandled type tag 0x0021 (DW_TAG_subrange_type), please file a bug and attach the file at the start of this error message
And one other thing, in the Variables Panel, I see an entry called this
which is expandable to a hex value. Presumably this is Code-Debug's interpretation of the FPC class instance: Self
.
The breakpoint was set in an event handler which had the FPC code:
procedure TCodePreviewForm.FormShow(Sender: TObject);
begin
LoadConfig;
...
end;
It correctly identified the Sender
parameter, although it did capitalise it. I try to exopand the value but it hung.
Incidentally, when I tried to set a watch on a class member FRoot
, it gave an error message `error: use of undeclared identifier 'FRoot' (from data-evaluate-expression FRoot).
I've made a bit of a break-through. Instead of expecting lldb to understand the Pascal language. I tried to think in C++ (Urgh!). I set this.FRoot
as my watch variable and it now shows:
error: member reference type 'TCODEPREVIEWFORM *' is a pointer; did you mean to use '->'?
error: no member named 'FRoot' in 'TCODEPREVIEWFORM' (from data-evaluate-expression this.FRoot)
This make sense, because although FPC (and Delphi) present class members like normal variables, behind the scenes it uses re-reference magic to strip away the pointer related syntax. So because I know next to nothing about C++, my question is how would I access a re-referenced instance of this
so that I can access its member variables such as FRoot (a string in this case)?
1) I don't think that's an issue with my extension, looks more like lldb or the program outputting that when run with a debugger
2) Those definitely are lldb bugs because it can't parse the object file
For the variable expansion: can you enable "printCalls": true, "showDevDebugOutput": true
in your debug launch config and send me the log when you try to expand the variable? Could be probably because of some output format I haven't implemented yet because it isn't really documented
3) Hm I don't know Pascal so I can't really help here a lot, maybe check google
lldb --version
lldb-370.0.42
It is supposed to be version >= 3.7.1. Presumably 370 is the equivalent of 3.7.0. I cannot find a stable version of lldb >= 3.7.1 intended for the Mac.
Lazarus 1.6.4
FPC 3.0.2
Apple Mac Pro (Early 2009) with upgraded v5.1 firmware
MacOS 10.12.5 Sierra
lldb-mi
appears to workcontents of .vscode/launch.json
I am trying to debug a program which I have written in Lazarus/FPC. My source is in a folder called
/Users/carl/Code/fpc/codepreview
and mylaunch.json
is in the folder/Users/carl/Code/fpc/codepreview/.vscode
. I can set breakpoints, but when I hit the green arrow, I am presented with a drop down where I type "LLDB", but nothing happens after that.I'm suspicious about the version of
lldb
but haven't yet found a suitable new version.