#925 sdcdb fails to open files w. two "." periods

closed-duplicate
nobody
None
5
2005-05-18
2005-05-18
No

SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/
ds400/hc08 2.5.0 #1027 (May 17 2005) (UNIX)

When trying to debug a program in a file with two "." in the
filename sdcdb fails to open the .ihx and .cdb files:

leopold@malthe$ sdcdb app.mangle
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.8 . Copyright (C) 1999 Sandeep Dutta (sandeep.
dutta@usa.net)
Type ? for help
WARNING: SDCDB is EXPERIMENTAL.
Cannot open file"app.cdb", no symbolic information loaded
uCsim 0.5.4, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details
type show w'.
This is free software, and you are welcome to redistribute it under
certain conditions; type show c' for details.
file "app.ihx"
Can't open app.ihx': No such file or directory
(sdcdb)

It seems that sdcdb tryies to extract the basename after the first
period. Investigating further the basename is constructed by the
following line of code (in sdcdb.c):
...
filename = strtok(argv[i],".");

Since strtok will scan the string for the first occurance of the
delimiter, this returns the filename up to the first period.

It is unclear to me what it is suppose to do. If I read the sdcc
manual[1] it seems to me that you are suppose to give the
"basename" of all the files generated by sdcc, that is
sdcc foo.c (makes .ihx, .cdb, ...)
sdcdb foo (reads .ihx, .c, ...)

Meaning that the filename should only be stripped of a suffix if it
was given by mistake. Meaning that sdcdb should check if
<filname>.ihx exists, if not maybee <filename> has a suffix that
should be removed and then <filname-suffix>.ihx exists.

The easy solution is ofcouse to simply remove the strtok, which
seems to work for me, this might however have implications in the
cmdFile and in turn the readCdb functions - i dunno.

[1]http://sdcc.sourceforge.net/doc/sdccman.html/node129.html

Discussion

  • Martin Leopold

    Martin Leopold - 2005-05-18
    • status: open --> open-duplicate
     
  • Martin Leopold

    Martin Leopold - 2005-05-18
    • status: open-duplicate --> closed-duplicate
     

Log in to post a comment.