cjacker / opensource-toolchain-stm8

Opensource toolchain for STM8 8-bit MCU
MIT License
0 stars 1 forks source link

stm8-gdb segfaults #1

Open brainstorm opened 6 hours ago

brainstorm commented 6 hours ago

I've followed the steps to install the stm8-gdb but it seems to segfault on my system?

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:    24.04
Codename:   noble

rvalls@framework:~/dev/personal/stm8-gdb/stm8-binutils-gdb-sources/binutils-2.30$ ldd `which stm8-gdb`
    linux-vdso.so.1 (0x00007ffcb233e000)
    libncursesw.so.6 => /lib/x86_64-linux-gnu/libncursesw.so.6 (0x0000723ca500d000)
    libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x0000723ca49cc000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000723ca48e3000)
    libpython3.12.so.1.0 => /lib/x86_64-linux-gnu/libpython3.12.so.1.0 (0x0000723ca4000000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x0000723ca48b8000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x0000723ca3fce000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000723ca3c00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000723ca5064000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x0000723ca3fb2000)

rvalls@framework:~/dev/personal/stm8-gdb/stm8-binutils-gdb-sources/binutils-2.30$ stm8-gdb
Segmentation fault (core dumped)

rvalls@framework:~/dev/personal/stm8-gdb/stm8-binutils-gdb-sources/binutils-2.30$ gdb stm8-gdb
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
(...)
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from stm8-gdb...
(gdb) run
Starting program: /usr/local/bin/stm8-gdb 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff75e6c51 in _PyInterpreterState_GET () at ../Include/internal/pycore_pystate.h:133
warning: 133    ../Include/internal/pycore_pystate.h: No such file or directory
(gdb) bt
#0  0x00007ffff75e6c51 in _PyInterpreterState_GET () at ../Include/internal/pycore_pystate.h:133
#1  get_state () at ../Objects/obmalloc.c:866
#2  _PyObject_Malloc (ctx=<optimized out>, nbytes=64) at ../Objects/obmalloc.c:1563
#3  0x000055555561e990 in do_start_initialization () at python/python.c:1718
#4  _initialize_python () at python/python.c:1930
#5  0x000055555589a556 in initialize_all_files () at init.c:176
#6  0x0000555555852189 in gdb_init (argv0=<optimized out>) at top.c:2133
#7  0x0000555555791063 in captured_main_1 (context=0x7fffffffdc00) at main.c:857
#8  captured_main (data=0x7fffffffdc00) at main.c:1146
#9  gdb_main (args=args@entry=0x7fffffffdc30) at main.c:1172
#10 0x00005555555caede in main (argc=<optimized out>, argv=<optimized out>) at gdb.c:32
(gdb) 

/cc @gicking

brainstorm commented 5 hours ago

Easy workaround/fix though:

--- configure_binutils.sh.orig  2024-11-02 01:02:37.591711483 +1100
+++ configure_binutils.sh   2024-11-02 01:00:05.406315778 +1100
@@ -9,4 +9,4 @@
   _PREFIX="-prefix=$PREFIX"
 fi

-./configure --host=$_HOST --target=stm8-none-elf32 $_PREFIX --program-prefix=stm8-
+./configure --without-python --host=$_HOST --target=stm8-none-elf32 $_PREFIX --program-prefix=stm8-