mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 23:54:16 +08:00
|
Some checks are pending
build and test / test-x86_64-linux (push) Waiting to run
build and test / test-x86_64-osx (push) Waiting to run
build and test / test-aarch64-osx (push) Waiting to run
build and test / test-x86_64-win32 (push) Waiting to run
build and test / test-i386-win32 (push) Waiting to run
build and test / test-armv7-linux (push) Waiting to run
build and test / test-aarch64-linux (push) Waiting to run
build and test / test-riscv64-linux (push) Waiting to run
I tried several gdb/lldb options to debug libtcc generated code. But gdb/lldb complained that they could not load symbols or that module does not exist. There was also another problem. The code itself was in memory (string) and gdb/lldb do not have functions to acces it. So I came up with a new api for debugging libtcc code. First you enable debugging with: tcc_set_options(s, "-g") Then compile the code with: tcc_compile_string_file(s, program, "<file>.c") Then call tcc_relocate(). And finaly write the object file to disk: elf_output_obj(s, "<file>.o") Now you can start the debugger and put an breakpoint after the elf_output_obj() code. Then use gdb command add-symbol-file <file>.o and from there on you can set breakpoints in the libtcc generated code. You can also step/print variables/... I could not find a simular function in lldb yet. When debugging is done you remove the tcc_set_options(s, "-g"). All other code can remain because tcc_compile_string_file and elf_output_obj do not output any file any more is debug is not set. See also tests/libtcc_debug.c |
||
|---|---|---|
| .. | ||
| pp | ||
| tests2 | ||
| 42test.h | ||
| abitest.c | ||
| arm-asm-testsuite.sh | ||
| asm-c-connect-1.c | ||
| asm-c-connect-2.c | ||
| asmtest.S | ||
| boundtest.c | ||
| bug.c | ||
| gcctestsuite.sh | ||
| libtcc_debug.c | ||
| libtcc_test_mt.c | ||
| libtcc_test.c | ||
| Makefile | ||
| nostdlib_test.c | ||
| tcctest.c | ||
| tcctest.h | ||
| testfp.c | ||
| vla_test.c | ||