WebFreak001 / code-debug

Native debugging for VSCode
The Unlicense
409 stars 115 forks source link

CodeDebug, LLDB, and FreePascal #145

Open pakLebah opened 6 years ago

pakLebah commented 6 years ago

Continuing #118 by @carlca …

{$MODE OBJFPC}{$H+}

uses CRT;

var s: string; c,r: integer; a: array of integer;

begin ClrScr;

// dynamic array test SetLength(a,10); for c := 0 to High(a) do a[c] := c;

// string test c := ScreenWidth; r := ScreenHeight; s := 'Screen size: ';

// input-output test writeln(s,c,'x',r); write('Type your name: '); readln(s); writeln('Hello, ',s,'!'); end.



- Compiler command:
`fpc test.pas -Px86_64 -gw2 -godwarfcpp`
It can be configured as a task.

Hope those problems will be fixed soon.

Thank you.
WebFreak001 commented 6 years ago

ii: general issue I found, not sure how to do a solution yet. iv: you could use gdb instead. lldb-mi does not have an option to redirect program output to another tty nor to spawn a separate terminal. v: can you specify that issue in more detail?

pakLebah commented 6 years ago

ii: I also have tried CodeLLDB extension. It's not using lldb-mi, it doesn't have such problem. But it has its own issues as well.

iv: CodeLLDB is able to redirect input/output through VS Code's integrated terminal. IMO, it gives better user experience. Mac has no gdb installed by default and I want to use lldb.

v: I think it's related to Debug Console due to codepage issue. Terminal could handle it well.

No response for i and iii?

WebFreak001 commented 6 years ago

i: probably not fixable, I didn't look into it yet but I could imagine the pascal compiler changing identifiers to all uppercase. iii: not investigated yet, probably just needs a bit of work on the lldb/gdb output parser/renderer.

pakLebah commented 6 years ago

i is not a big problem, I can live with that as long as the variables are available on the debug panel (ii).

But iii and iv are deal breakers for me. How can I debug my code if I couldn't watch some important variables? Changing them into static arrays requires too much changes.

Workaround for v is not too hard, I can accept that.