Page 1 of 1

[Tutorial] Debugging (with breakpoints) on C series

Posted: Mon Oct 05, 2015 3:17 pm
by sectroyer
  • Unpack attached archive to /mtd_rwcommon/
  • copy /mtd_rwcommon/gdb to some location from PATH variable
  • add to your .gdbinit:

    Code: Select all

    set libthread-db-search-path /mtd_rwcommon/debug/lib/
    set auto-load safe-path /mtd_rwcommon/debug/lib/
Breakpoints should now be working :)

Re: [Tutorial] Debugging (with breakpoints) on C series

Posted: Tue Oct 27, 2015 8:11 pm
by plasticassius
Wow, this is exciting! I've tried to get gdb working, but never got very far. In order to try out your version of gdb, I thought I'd try to make a patch to allow media playback from an xfs format usb drive. However, I'm having some problems. Would you let me know if you can see problems with what I'm doing?

I started gdb with

Code: Select all

gdb /mtd_exe/exeDSP 61
After I did that, when I pressed MEDIA (or any other remote button), the led on the tv flash, but the button has no other effect. After, when I exit gdb with quit, the button has it's effect. Since the button doesn't seem to execute anything while gdb is running, I thought that exeDSP wasn't running. However, when I type 'run' to gdb, I get "The program being debugged has been started already." I want to place breakpoints to see what happens when I press MEDIA, but pressing MEDIA doesn't do anything when gdb is running.

Re: [Tutorial] Debugging (with breakpoints) on C series

Posted: Tue Oct 27, 2015 10:55 pm
by sectroyer
plasticassius wrote:Wow, this is exciting! I've tried to get gdb working, but never got very far. In order to try out your version of gdb, I thought I'd try to make a patch to allow media playback from an xfs format usb drive. However, I'm having some problems. Would you let me know if you can see problems with what I'm doing?

I started gdb with

Code: Select all

gdb /mtd_exe/exeDSP 61
After I did that, when I pressed MEDIA (or any other remote button), the led on the tv flash, but the button has no other effect. After, when I exit gdb with quit, the button has it's effect. Since the button doesn't seem to execute anything while gdb is running, I thought that exeDSP wasn't running. However, when I type 'run' to gdb, I get "The program being debugged has been started already." I want to place breakpoints to see what happens when I press MEDIA, but pressing MEDIA doesn't do anything when gdb is running.
You start gdb incorrectly you should use:

Code: Select all

gdb --pid 61
or even better:

Code: Select all

gdb --pid `pidof exeDSP`

Re: [Tutorial] Debugging (with breakpoints) on C series

Posted: Wed Oct 28, 2015 5:54 am
by plasticassius
Thanks, but it behaves the same when I start it the way you recommend.

Re: [Tutorial] Debugging (with breakpoints) on C series

Posted: Wed Oct 28, 2015 3:42 pm
by sectroyer
plasticassius wrote:Thanks, but it behaves the same when I start it the way you recommend.
I think you don't know how to use gdb :P After starting gdb program is HANGED. You nee to use:

Code: Select all

continue
command to resume it :P It's NORMAL tv doesn't react :P

Re: [Tutorial] Debugging (with breakpoints) on C series

Posted: Wed Oct 28, 2015 7:35 pm
by plasticassius
Yes! Thanks! I ran continue and exeDSP became resposive! However, afterwards, the gdb prompt didn't reappear. I take it that only one of gdb or exeDSP runs at a time. Although, I'm getting messages from gdb about threads starting and exiting.

You're right that I don't have much experience with gdb, but I think that I'll be able to learn more about it now. My next step will be to try out breakpoints and watchpoints.