Page 1 of 1

C program debugging with eclipse

Posted: Tue Oct 10, 2017 7:59 pm
by kermit
Hello
Have someone tried debugging C program for voCore2 and succeed?
I followed this tutorial to setup eclipse:
https://docs.labs.mediatek.com/resource ... clipse-ide
Everything goes fine, untill i stuck with error which goes "remote 'g' packet reply is too long" (see attachment 1)


None of set main() breakpoints working, something only stucks at program start(see attachment 2), but i don`t now why debugger set program counter there, when i try to resume program i get mentioned error

Greetings

Re: C program debugging with eclipse

Posted: Thu Oct 12, 2017 2:19 pm
by Vonger
As I know it is a GDB issue, you need to recompile your GDB with a special flag...(can not remember but can be find at google), then replace the default GDB of eillesp currently using, everything will work.
I have tried this before and get same result when using command line, solved by recompile GDB, later I will update my blog, good luck.

Re: C program debugging with eclipse

Posted: Thu Oct 12, 2017 6:37 pm
by kermit
Wow, finally after three days i resolved this issue, thanks for hint Vonger.
So, problem was with missing expat library, if someone will have similar problem this is what You have to do:
1. Install expat library on your host machine
on ubuntu 15.04:
Code: Select all
 sudo apt-get install expat libexpat1-dev

probably only one of these are needed, but don`t really sure which one of these
2. Edit gdb makefile( [openWrt_dir]/toolchain/gdb/Makefile ), we need to add line " --with-expat" to "define Host/Configure" procedure
so it looks like this
Code: Select all
define Host/Configure
   (cd $(HOST_BUILD_DIR); \
      gdb_cv_func_sigsetjmp=yes \
      CFLAGS="-O2" \
      $(HOST_BUILD_DIR)/configure \
      --prefix=$(TOOLCHAIN_DIR) \
      --build=$(GNU_HOST_NAME) \
      --host=$(GNU_HOST_NAME) \
      --target=$(REAL_GNU_TARGET_NAME) \
      --disable-werror \
      --without-uiout \
      --disable-tui --disable-gdbtk --without-x \
      --without-included-gettext \
      --enable-threads \
      --with-expat \
   );
endef

3. Rebuild gdb with command
Code: Select all
make toolchain/gdb/{clean,compile,install}

Re: C program debugging with eclipse

Posted: Thu Oct 12, 2017 11:34 pm
by noblepepper
This post may be of interest. It is very old, it worked with the original VoCore2 sources. There will be some differences, at least the part about SD card error messages isn't needed any more.

All of my eclipse/openwrt info is based on this