User forums > Embedded development

Run bash script before remote debugging

(1/2) > >>

bigwcharly:
Hi all

How does the "Additional shell commands" tab work?
Debugging my application works, but I don't manage to get my commands to run before connecting to the remote gdbserver.
What I want to achieve in the end is that before debugging
1.) my binaries are copied to the remote device and
2.) the gdbserver is started on the remote device

I've found a similar - unanswered - question on sourceforge from 2009.

I'm using the latest version of C::B on Ubuntu 12.04.

Many thanks!

oBFusCATed:
Can you post the full log from the debugger? And make sure that you're using C::B >=12.11.

scarphin:

--- Quote from: bigwcharly on May 16, 2014, 02:14:47 pm ---1.) my binaries are copied to the remote device and

--- End quote ---
Just insert your command line to copy the files.


--- Quote from: bigwcharly on May 16, 2014, 02:14:47 pm ---2.) the gdbserver is started on the remote device

--- End quote ---
I always thought 'additional shell commands' feature was the perfect way to start the gdbserver before debugging but unfortunately that's not possible. The problem is gdb waits for the executed program to end before continuing and in that case gdbserver waits for gdb to make a connection and gdb waits for gdbserver to terminate to resume debugging (to make the connection). Quite ironic. It's been way too long since I quit trying to make this work so I don't know if there is a new trick though.

bigwcharly:
Hi

These are the commands I entered before connetion:


--- Code: ---scp ../../../Binaries/debug/Tests pi@192.168.2.100:/home/pi/Development/Test
ssh pi@192.168.2.100 "gdbserver :5000 /home/pi/Development/Test/Tests"

--- End code ---

This is the debug log:


--- Code: ---Building to ensure sources are up-to-date
Selecting target:
debug
Adding source dir: /home/developer/Development/svn/Source/Projects/Tests/
Adding source dir: /home/developer/Development/svn/Source/Projects/Tests/
Adding file: /home/developer/Development/svn/Binaries/debug/Tests
Changing directory to: /home/developer/Development/svn/Source/Projects/Tests/.
Set variable: LD_LIBRARY_PATH=.:/home/developer/Development/svn/Libraries/debug:/home/developer/Development/svn/Source/Thirdparty/jsoncpp/lib:/home/developer/Development/svn/Source/Thirdparty/sqlite/lib:
Starting debugger: /home/developer/Development/svn/Tools/crosstools-ng/bin/bin/arm-unknown-linux-gnueabi-gdb -nx -fullname  -quiet  -args /home/developer/Development/svn/Binaries/debug/Tests
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Connecting to remote target
Setting breakpoints
Debugger name and version: GNU gdb (crosstool-NG 1.18.0) 7.4.1
Connected
In process_dl_audit () (/home/developer/Development/svn/Tools/crosstools-ng/bin/arm-unknown-linux-gnueabi/sysroot/lib/ld-linux.so.3)
[Inferior 1 (Remote target) exited normally]
No stack.
Debugger finished with status 0

--- End code ---

My version of C::B is "svn build rev 9639 (2014-02-08 09:33:14) gcc 4.6.3 Linux/unicode - 64 bit". This should be version 13.12.
As I'm on Ubuntu 12.04 I've installed this version from https://launchpad.net/~pasgui/+archive/ppa/

Still, the problem is that my commands don't get executed. Even if I try just a "cp ./SomeFile ./here/" this doesn't happen...
Maybe something's wrong with my commands. Could someone point me to my error or give an example?

oBFusCATed:
This is not the full log, you have to enable it in the settings.

@scraphin: Have you tried to execute a shell script that starts gdbserver as a background job and exits (probably using nohup)?

Navigation

[0] Message Index

[#] Next page

Go to full version