In current SDCC 3.6.9 #10195, there seems to be an issue with debug in for for local variables in the attached example.
While printing the value of the global unsigned long and the local
unsigned int worked well, there are problems with the local unsigned long:
Breakpoint 1, longtest () at test.c:54
54 luint = lulong & 0xfff;
(gdb) p/x lulong
$1 = 0x81500055
(gdb) step
56 lulong |= 0x55ul;
(gdb) p/x lulong
$2 = 0x81500055
(gdb) step
58 luint++;
(gdb) p/x lulong
$3 = 0x55aa55
In the compiler, the local unsigned long lives in multiple temporary
variables (iTemp5, iTemp21, iTemp9, iTemp4, iTemp13, iTemp22) during its
lifetime.
Philipp
Wiki: SDCC 4.3.0 Release
Wiki: SDCC 4.4.0 Release
Wiki: SDCC 4.5.0 Release
It seems SDCC does not keep track of the iTemp a local
variable is decomposed into. Usually one can be found in reqv (iTemp4
in this case). But that is not enough.
Philipp