I cannot debug because GDB doesn't load the symbol table

Hi

I’m using mspgcc as compiler for the msp430f149 and it works great!! I can load the elf file to the mcu using GDB, however when I try to debug step by step GDB says there is not a symbol table, so cannot set breakpoints. I use the -g and -O0 options when building. Am I missing something?? Do I need some option when building??

By the way I try to debug under Eclipse but I couldn’t, has anyone done it??

Thanks =)

Probably gdb just doesn’t know where to find the symbol table for the code that it sees on the mcu. Have you tried the ‘symbol-file’ command in gdb?

Thanks for your answer!! I will try it as soon as I understand what is the next error about, it appears suddenly

C:\fjrg76\c\pruebaMSP430gcc\pruebacpp>msp430-gdb main.elf

GNU gdb 5.1.1

Copyright 2002 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type “show copying” to see the conditions.

There is absolutely no warranty for GDB. Type “show warranty” for details.

This GDB was configured as “–host=i686-pc-cygwin --target=msp430”…

remote.c:1897: gdb-internal-error: sect_index_data not initialized

(gdb)

I’ve tried with several versions of GDB and it still is there =(

I hope you know what is this about. Thanks =)

wiml:
Probably gdb just doesn’t know where to find the symbol table for the code that it sees on the mcu. Have you tried the ‘symbol-file’ command in gdb?

Hi again wiml

I did what you told me and it works!! I want to share the way I did it.

  1. Open one console, go where the .elf file to debug is in and start the gdbproxy

c:\ FOLDER_WHERE_ELF_IS _LOCATED\msp430-gdbproxy --port=3333 msp430

  1. Open a new console, go where the .elf file to debug is in and start gdb

c:\ FOLDER_WHERE_ELF_IS _LOCATED\msp430-gdb

(gdb) load main.elf

(gdb) symbol-file main.elf

(gdb) br main

(gdb) c

If you don’t have gdb.ini try this (it’s a single line), it works fine to me. Save it where the .elf file is located

target remote localhost:3333

(that’s all!!)

*Remember that before debugging the .elf file must be downloaded into the chip

  1. Type the program

  2. Compile and link

  3. Download

  4. Debug

  5. Comeback to point 1 as many times as needed

In order to automate tasks the gdb.ini file may contain the next lines. Again, it works for me

target remote localhost:3333

load main.elf

symbol-file main.elf

br main

c

Just change the name of the .elf file if needed. Good luck!! =)

I tried setting symbol-file in gdbinit but that didn’t work and will stick with declaring an unused global which seems to work.

#include <msp430x20x3.h>

int unused_initialized_variable_to_make_gdb_happy = 1;