This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB can not read debug symbols


Greetings,

I am experimenting with the msp430-elf port of gdb (7.10) and it seems
it is not reading debugging symbols gcc (5.2.0) is issuing.

The test program is:

#include <msp430.h>

__attribute__((noreturn)) void main() {
	WDTCTL = WDTPW | WDTHOLD;
	P1DIR = 0xff;
	P1OUT = 0xff;
	while(1) {
		__delay_cycles(2500000);
		P1OUT ^= 0xff;
	}
}

And it is compiled with:

$msp430-elf-gcc -g -O0 -mmcu=msp430f2013 test.c -o test.elf

readelf reports:

CU: ./test.c:
File name                            Line number    Starting address
hello.c                                        5              0xf924
hello.c                                        6              0xf924

hello.c                                        7              0xf92a

hello.c                                        8              0xf92e

hello.c                                       12              0xf932

hello.c                                       13              0xf94e

hello.c                                       14              0xf95c


When testing the program on hardware through mspdebug

$ msp430-elf-gdb ./test.elf
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu
--target=msp430-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test.elf...done.
(gdb) target remote :1234
(gdb) break main
Breakpoint 1 at 0xf924
(gdb) cont
Continuing.

Breakpoint 1, 0x0000f924 in main ()
(gdb) step
Single stepping until exit from function main,
which has no line number information.

At this point, gdb singlesteps forever, unable to trace through the
program. However, if compiling the program using

$ msp430-elf-gcc -gstabs -O0 -mmcu=msp430f2013 test.c -o test.elf

readelf no longer reports any line number information, but GDB works as
intended. Attached is the linker script being used. Thank you.

Cheers,
Orlando.

Attachment: msp430f2013.ld
Description: Text document

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]