Re: [uCsimm] gdb/gdbserver

From: 권석근 (
Date: Fri Jan 28 2000 - 00:32:53 EST

Hi, Stuart Hughes

>I'm trying to get the gdb/gdbserver stuff that kwonsk did running. I
>seems to have it functional, but I still have a problem with the level
>of debugging information.

Thanks for your trying.

>If I compile with -g, I don't get any line numbers, and do I cant step
>and trace properly I get the following messages:
>Breakpoint 1, 0x7000ac in main ()
>(gdb) s
>Single stepping until exit from function main,
>which has no line number information.

Could you see right source listing when you tried 'list' command?
(gdb) list could see .your C source codes

If this is true, you might compiled your source with -g option successfully.
Then, do not try single stepping at the first time.
Make initial break point first, like this
(gdb) b 1
This will make break point at line 1 of main source, gdb will automatically
setup break point at the first machine instruction (crt0.o).
When you try this you will see the message saying

Breakpoint 1 at 0x????????: file test.c, line 1
(You must see this message which saying gdb is tracking
right source and line number with information in .coff symbol tables)

After now, you coud do any debugging command.
Why this initial break point? -> Try native gdb on your desktop linux (not
you couln't do 'step' command at the very first time. you must do 'run'
command before
step command. this means you must make first break point before run (run
just runs
program to the end) and then try step.

>If I try to build with -g2 or -g3 to get the debugging information, I
>get errors:
>[root@dell test]# m68k-pic-coff-gcc flash.c -g2 -o flash
>/opt/uClinux/m68k-pic-coff/bin/gld: cannot open -lg: No such file or
>mv: flash: No such file or directory

Gcc will append -lg option when it sees -g options, this could be removed
(auto appending
option) from Spec file
I've said this before.
1.4.4 patch /opt/lib/gcc-lib/m68k-pic-coff/
why this? this make linker easy. they will complaning about gcrt0.o
libg.o when they compile with -g option.
change *startfile spec {g:gcrt0%O%s} to {g:crt0%O%s}
change *lib spec: remove {g:-lg...}

>BTW: even with plain -g I still get a warning:
>[root@dell test]# m68k-pic-coff-gcc flash.c -g -o flash
>/opt/uClinux/m68k-pic-coff/bin/gld: cannot open gcrt0.o: No such file or

This is because of the same reason above. Gcc will automatically select
gcrt0.o rather than
crt0.o when it meets -g option. This also could be removed using spec file.

But, if you do not want to change original specs files, then
just make gcrt0.o like this
#cd /opt/uClinux/m68k-pic-coff/lib
#cp crt0.o gcrt0.o
and make libg.a like this
#cp libc.a libg.a (or make dummy libg.a)


This message resent by the list server

This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:34 EST