Menu

#3529 SDCC .cdb debug file format change

closed-fixed
None
other
5
2024-02-04
2022-12-13
No

SVN revision 10450 changed the generated cdb file format to add support for C99 intermingling of declaration and statements but SDCDB was not changed to parse the new format.

The numeric 'level' value was changed into 'levelmsb_levellsb' which SDCDB incorrectly parses. This can cause crashes when setting breakpoints amongst other symbol issues.

As far as I can see this change to the cdb file format is now documented anywhere and conflicts with the documentation found at https://sourceforge.net/p/sdcc/wiki/CDB%20File%20Format/.

This problem affects all platforms.

These changes affect all releases of SDCC from 3.8.0 onwards.

Related

Patches: #449
Patches: #450

Discussion

  • Mark Symonds

    Mark Symonds - 2022-12-29

    To reproduce this bug build the example source file shown below and run in sdcdb using:

    sdcc --debug bug3529.c
    sdcdb -cpu 8051 bug3529 -z -b
    

    Using sdcc 3.6.0 b[reak] main and b[reak] load_all work as expected. Using sdcc 4.2.0 and the current SVN head they cause the debugger to exit with an illegal memory access. This occurs on Windows 10 and Debian Bullseye.

    Save the code below as bug3529.c

    struct all
    {
        char buff[20];
    
    } volatile testall;
    
    void load_all()
    {
        int x;
    
        for(x = 0; x < 10; x++)
            testall.buff[x] = x * 2;
    }
    
    int main(void)
    {
        int n;
    
        for(n = 0; n < 10; n++)
        {
            volatile int var = n;
            testall.buff[n] = var;
    
            load_all();
        }
    
        return 0;
    }
    
     
  • Benedikt Freisen

    • status: open --> closed-fixed
    • assigned_to: Benedikt Freisen
     

Log in to post a comment.

MongoDB Logo MongoDB