digitalmars.D.learn - cannot gdb LDC build binary: Segmentation fault
- mw (37/37) Oct 06 2022 Hi,
- user1234 (3/8) Oct 08 2022 Try the non-stop mode maybe :
- Sergey (3/6) Oct 08 2022 Did you try to use GDC? As gdb more gcc tool
- Siarhei Siamashka (10/12) Oct 08 2022 If you are compiling your program with "-release" command line
Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debug it. However under gdb, the program fails as soon as I start it: ``` (gdb) r [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x155544f17700 (LWP 55978)] [Thread 0x155544f17700 (LWP 55978) exited] [New Thread 0x15555554b700 (LWP 55979)] [New Thread 0x155555542700 (LWP 55980)] [New Thread 0x155555539700 (LWP 55981)] [New Thread 0x155555530700 (LWP 55982)] [New Thread 0x1555553b2700 (LWP 55983)] [New Thread 0x1555553a9700 (LWP 55984)] [New Thread 0x1555553a0700 (LWP 55985)] [New Thread 0x155555397700 (LWP 55986)] [New Thread 0x15555538e700 (LWP 55987)] [New Thread 0x155555385700 (LWP 55988)] Thread 11 "lt" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x15555538e700 (LWP 55987)] __GI___get_nprocs () at ../sysdeps/unix/sysv/linux/getsysstats.c:146 146 ../sysdeps/unix/sysv/linux/getsysstats.c: No such file or directory. (gdb) q A debugging session is active. Inferior 1 [process 55973] will be killed. Quit anyway? (y or n) y ``` Without gdb, the program at least can run for a while, and make some progress before it core dumps. Has anyone experienced such problem before? any suggestions where I should look at? Thanks.
Oct 06 2022
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote:Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debug it. However under gdb, the program fails as soon as I start it: [...]Try the non-stop mode maybe : https://sourceware.org/gdb/onlinedocs/gdb/Non_002dStop-Mode.html
Oct 08 2022
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote:Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debugDid you try to use GDC? As gdb more gcc tool And for llvm should be lldb..
Oct 08 2022
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote:Has anyone experienced such problem before? any suggestions where I should look at?If you are compiling your program with "-release" command line option, then arrays bounds checking is not done in the system code at all (which is all of your code by default). Either remove this "-release" option or try to mark all of your code as safe and check whether the problem manifests itself in a nicer and more obvious way. Also in GDB it's always useful to look at the output of the "bt" (backtrace) command. Running your program under valgrind may also reveal something.
Oct 08 2022