Menu

sdcdb always crashes on run or set breakpoint

2020-11-11
2022-02-21
  • Michael Mayer

    Michael Mayer - 2020-11-11

    sdcdb always crashes with a segfault when I want to set a breakpoint:

    $ cat sdcdbtest.c
    int a;
    
    void main(void)
    {
        a = 1;
    }
    $ sdcc --debug sdcdbtest.c
    $ sdcdb sdcdbtest.cdb 
    file "sdcdbtest.ihx"
    SDCDB is free software and you are welcome to distribute copies of it
    under certain conditions; type "show copying" to see the conditions.
    There is absolutely no warranty for SDCDB; type "show warranty" for details.
    SDCDB 0.9. Copyright (C) 1999 Sandeep Dutta (sandeep.dutta@usa.net)
    Type ? for help
    WARNING: SDCDB is EXPERIMENTAL.
    (sdcdb) b main
    Segmentation fault (core dumped)
    

    It does not matter which CPU type is specified (none or -mstm8, didn't test more) or which filename is given on startup - cdb or ihx.
    The only thing that does at least something is a simple "break" without parameters or "break" with names that don't exist:

    $ sdcdb sdcdbtest.cdb 
    file "sdcdbtest.ihx"
    SDCDB is free software and you are welcome to distribute copies of it
    under certain conditions; type "show copying" to see the conditions.
    There is absolutely no warranty for SDCDB; type "show warranty" for details.
    SDCDB 0.9. Copyright (C) 1999 Sandeep Dutta (sandeep.dutta@usa.net)
    Type ? for help
    WARNING: SDCDB is EXPERIMENTAL.
    (sdcdb) break
    Breakpoint 1 at 0x0: file sdcdbtest.c, line 0.
    (sdcdb) info break
    Num Type           Disp Enb Address    What
    1   breakpoint     keep y   0x00000000 at sdcdbtest.c:0
    (sdcdb) info source
    Current source file is sdcdbtest.c
    Located in sdcdbtest.c
    Contains 6 lines.
    Source language is c.
    (sdcdb) break 1
    No line 0 or after in file "sdcdbtest.c"..
    (sdcdb) break _main
    No line 0 or after in file "sdcdbtest.c"..
    (sdcdb)  break abc
    Function "abc" not defined.
    

    Am I getting it totally wrong or is sdcdb really not useable? It would be super useful.

    I tried this with an older snapshot build and with the 4.0.0 release, compiled on my system from the official 4.0.0 source archive.

    $ sdcc -v
    SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 3.9.1 #11242 (Linux)
    published under GNU General Public License (GPL)
    
     
  • Alfred Chen

    Alfred Chen - 2021-06-15

    Hi, Michael. Have you fixed the segmentation fault?

     
  • Michael Mayer

    Michael Mayer - 2022-02-21

    Sorry, your question got lost in my inbox. No, the problem is still there for me with both, the official package for 4.0.0 and 4.1.0 (build #12072). For 4.0.0 I used the official binary build, for 4.1.0 I compiled the source myself, because the binary package does not work with the libraries on my system (Mint 20.2, based on Ubuntu 20.04).
    I removed all other versions of sdcc out of the path to make sure that I don't versions here.
    I tried strace, but it does not show any trace of an attempt to execute the simulator binary. Is this right? No fork, no open, no exec. Here are the last few lines. The prompt is written, my input is read and then - nothing.

    write(1, "(sdcdb) ", 8)                 = 8
    fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x5), ...}) = 0
    read(0, "b main\n", 1024)               = 7
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28} ---
    +++ killed by SIGSEGV (core dumped) +++
    

    The full trace for a stock v4.0.0 is attached to this message.

     

Log in to post a comment.

MongoDB Logo MongoDB