Re: [Tinycc-devel] Bug using -g with line directive
Herman thank you very much. I'm amazed you made these fixes so quickly. On linux things seem to look good. Adding "miDebuggerArgs": "--readnow"` to vscode launch.json solves my problem. I don't develop on mac much. I'm satified with the latest patch. I can confirm that I am able to set break points, print variables, move around the stack and print the local variables. vscode is unusable but there's probably 0 people using my compiler who uses mac. I'm perfectly content with the present state, I can debug with it without a problem (or at least I believe I can, I have no mac specific code I'd like to debug). I noticed when a breakpoint hits (on mac) it doesn't show the source while clang build does. I just thought I'd report it, I'm perfectly content. tcc -g a.c bash-3.2# lldb a.out (lldb) target create "a.out" Current executable set to '/private/tmp/t/a.out' (arm64). (lldb) b a.bolin:5 Breakpoint 1: where = a.out`test0 + 32 at a.bolin:5, address = 0x00011020 (lldb) r Process 1178 launched: '/private/tmp/t/a.out' (arm64) Process 1178 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00011020 a.out`test0 at a.bolin:5 Target 0: (a.out) stopped. (lldb) gcc -g a.c -o b.out bash-3.2# lldb b.out (lldb) target create "b.out" Current executable set to '/private/tmp/t/b.out' (arm64). (lldb) b a.bolin:5 Breakpoint 1: where = b.out`test0 + 16 at a.bolin:5:17, address = 0x00013f08 (lldb) r Process 1183 launched: '/private/tmp/t/b.out' (arm64) Process 1183 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00013f08 b.out`test0 at a.bolin:5:17 2array := $s32[10] 3array[0] = 0 4array[1] = 3 -> 5array[2] = 6 6array[3] = 9 7array[4] = 12 8array[5] = 15 Target 0: (b.out) stopped. (lldb) ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] Bug using -g with line directive
On 1/16/23 20:33, Herman ten Brugge wrote: On 1/16/23 16:14, Levo D wrote: Using ee3fef2ce2a8c46452ff44b59d5175dc90bf4f4c I compiled and tested in 3 places using make install before the test 1. Local machine, crashes using gdb 12.1 2. Debian box, works, using 10.1 3. Mac, doesn't work using lldb-1400.0.38.13. Copying the binary I made on the debian box to my local computer upset gdb 12.1. Using tcc -g -nostdlib (otherwise debian gdb complains about wrong glibc version) I am able to debug it using gdb 10.1 on my debian box Should I write a debug report to gdb? The error it gives is "../../gdb/psymtab.c:1142: internal-error: expand_symtabs_matching: Assertion `symtab != nullptr' failed." I See problem 1 when using stab format. This is deprecated in gcc and probably will be deprecated in gdb. Please use dwarf. I just pushed an update for macos. The DW_LNS_set_file dwarf has an offset of 1 on macos. I used an older gcc to compile the code with -gstabs (gcc 12.2.1 does not support stabs anymore) and then gdb also dumps core. If I use: gdb --readnow ./a.out -batch -ex 'br a.bolin:5' -ex 'r' It works with older gcc and tcc. So it is probably a stabs bug in gdb. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] Bug using -g with line directive
On 1/16/23 16:14, Levo D wrote: Using ee3fef2ce2a8c46452ff44b59d5175dc90bf4f4c I compiled and tested in 3 places using make install before the test 1. Local machine, crashes using gdb 12.1 2. Debian box, works, using 10.1 3. Mac, doesn't work using lldb-1400.0.38.13. Copying the binary I made on the debian box to my local computer upset gdb 12.1. Using tcc -g -nostdlib (otherwise debian gdb complains about wrong glibc version) I am able to debug it using gdb 10.1 on my debian box Should I write a debug report to gdb? The error it gives is "../../gdb/psymtab.c:1142: internal-error: expand_symtabs_matching: Assertion `symtab != nullptr' failed." I See problem 1 when using stab format. This is deprecated in gcc and probably will be deprecated in gdb. Please use dwarf. I just pushed an update for macos. The DW_LNS_set_file dwarf has an offset of 1 on macos. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] Bug using -g with line directive
On 1/16/23 02:31, Levo D wrote: I'm interested in using tcc as a backend for debug builds in my compiler. It appears that when I compile with '-g' it works fine but tcc has problems when I use the line directive to specify my source file. Below is an example of my source and an example c output. If you compile the c code with 'tcc -g test.c' and run the gdb command below gdb will complain and show an internal error. This happens on linux (x86-64). On mac lldb is also unhappy Is the below enough information as a bug report? You can use the following regex to remove the '#line' from the c file \t?#line.*\n gdb ./a.out -batch -ex 'br a.bolin:5' -ex 'r' I just pushed a fix for this. Can you try again. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel