using 4.2.0 rc2
sdcdb crashes upon entering: b main
gdb --args /opt/sdcc/bin/sdcdb -mz80 hello.com
(gdb) r
SDCDB 0.9. Copyright (C) 1999 Sandeep Dutta (sandeep.dutta@usa.net)
Type ? for help
WARNING: SDCDB is EXPERIMENTAL.
(sdcdb) b main
Program received signal SIGSEGV, Segmentation fault.
0x0000000000408f14 in setBPatModLine (mod=0x0, line=0, bpType=4 '\004')
at cmd.c:396
396 cmd.c: No such file or directory.
(gdb) bt
#0 0x0000000000408f14 in setBPatModLine (mod=0x0, line=0, bpType=4 '\004')
#1 0x000000000040ad2e in commonSetUserBp (s=0x6235a2 <cmdbuff+2> "main",
cctxt=0x629c60, bpType=4 '\004') at cmd.c:1163
#2 0x000000000040ad8c in cmdSetUserBp (s=0x6235a1 <cmdbuff+1> " main",
cctxt=0x629c60) at cmd.c:1186
#3 0x000000000040324c in interpretCmd (s=0x6235a0 <cmdbuff> "b main")
at sdcdb.c:1036
#4 0x000000000040351e in commandLoop (cmdfile=0x7ffff7ffb1e0 <__stdin_FILE>)
at sdcdb.c:1650
#5 0x000000000040467d in main (argc=3, argv=0x7fffffffeb58) at sdcdb.c:2121
hello.com was produced like this:
/* the first function is the entry point, do not remove this */
void _start(void) __naked{
__asm;
ld sp, #0xff00
add ix, sp
jp _main
__endasm;
}
/* arg1 comes in hl */
void puts(const char *const str) __sdcccall(1)
{
str;
__asm
ex de, hl
ld c,#9
call 5
__endasm;
}
int main()
{
puts("Hello world$");
return 0;
}
makefile:
CC=sdcc
CFLAGS=-mz80 --code-loc 0x100 --no-std-crt0 --debug
hello.com:
%.ihx: %.c
$(CC) $(CFLAGS) $<
%.com: %.ihx
objcopy -Iihex -Obinary $< $@
test -e $*.cdb && mv $*.cdb $*.com.cdb
echo $<
%.rel: %.s
sdasz80 -o $<
clean:
rm -rf *.sym *.rel *.lk *.lst *.noi *.map *.cdb hello.com