Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Debugging Rockbox with GDB and UI Simulator
« previous next »
  • Print
Pages: [1]

Author Topic: Debugging Rockbox with GDB and UI Simulator  (Read 1641 times)

Offline necrostaz

  • Member
  • *
  • Posts: 2
Debugging Rockbox with GDB and UI Simulator
« on: August 17, 2009, 08:22:03 AM »
Hi. I'm a newbie in debugging with GDB. Please explain me how to debug Rockbox code with GDB for some steps. I've tried to load rockboxui in gdb, but it was stopped. And i tried attach  to simulator process and set up break points, but gdb can't proceed my breaks(I think because target libraries was not loaded in that time) Thanks/
Logged

Offline dreamlayers

  • Developer
  • Member
  • *
  • Posts: 425
  • Boris Gjenero
    • My Blog
Re: Debugging Rockbox with GDB and UI Simulator
« Reply #1 on: August 17, 2009, 10:29:41 AM »
For me, GDB simply works in Cygwin.  I just run "gdb rockboxui.exe", set up breakpoints if necessary and then "run".  GDB has been very helpful when investigating some bugs.

If I try to set a breakpoint at a symbol that's not currently loaded, I am asked if I want to make it pending on shared library load.  I simply answer yes.  This can be used to create breakpoints in codecs and plugins.

Here's an example:
Code: [Select]
Boris@Vortex ~/rockbox-svn-trunk/5sim
$ gdb rockboxui.exe
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 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 "i686-pc-cygwin"...
(gdb) b flac_init
Function "flac_init" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (flac_init) pending.
(gdb) run
Starting program: /home/Boris/rockbox-svn-trunk/5sim/rockboxui.exe
[New thread 14916.0x2dcc]
[New thread 14916.0x3290]
[New thread 14916.0x2270]
[New thread 14916.0x14c4]
[New thread 14916.0x1874]
[New thread 14916.0x1340]
[New thread 14916.0x31d4]
[New thread 14916.0x21c0]
[New thread 14916.0x3b00]
[New thread 14916.0x9fc]
[New thread 14916.0x638]
[New thread 14916.0x2d88]
[New thread 14916.0x2bb0]
[New thread 14916.0x295c]
[New thread 14916.0x2548]
[New thread 14916.0x348c]
[New thread 14916.0x2f4]
[New thread 14916.0x1720]
[New thread 14916.0x3444]
[Switching to thread 14916.0x2bb0]

Breakpoint 1, flac_init (fc=0x75efca0, first_frame_offset=0)
    at /home/Boris/rockbox-svn-trunk/apps/codecs/flac.c:77
77          bool found_streaminfo=false;
(gdb) l
72      static size_t buff_size;
73
74      static bool flac_init(FLACContext* fc, int first_frame_offset)
75      {
76          unsigned char buf[255];
77          bool found_streaminfo=false;
78          uint32_t seekpoint_hi,seekpoint_lo;
79          uint32_t offset_hi,offset_lo;
80          uint16_t blocksize;
81          int endofmetadata=0;
(gdb) n
81          int endofmetadata=0;
(gdb)
84          ci->memset(fc,0,sizeof(FLACContext));
(gdb)
85          nseekpoints=0;
(gdb)
Logged

Offline necrostaz

  • Member
  • *
  • Posts: 2
Re: Debugging Rockbox with GDB and UI Simulator
« Reply #2 on: August 17, 2009, 11:14:07 AM »
Thanks a lot.   :) It works for me if i attach to process, but i can't run gbd run statically, because it exits. But no matter  :)
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Debugging Rockbox with GDB and UI Simulator
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.022 seconds with 16 queries.