User forums > Embedded development
Run bash script before remote debugging
scarphin:
--- Quote from: oBFusCATed on May 17, 2014, 05:35:49 pm ---@scraphin: Have you tried to execute a shell script that starts gdbserver as a background job and exits (probably using nohup)?
--- End quote ---
No, I haven't and I can't. I'm on Windows, sorry for missing information.
Fortunately I found a way to resolve this. Instead of using cmd.exe to launch the gdbserver, using start.exe launches a separate process and returns without waiting for the process to finish.
Unfortunately I can confirm the execution of 'additional shell commands' fails, here is the full log:
--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: D:\coding\projects\own\procpp\
Adding source dir: D:\coding\projects\own\procpp\
Adding file: D:\coding\projects\own\procpp\bin\Debug\procpp.exe
Changing directory to: D:/coding/projects/own/procpp/.
Set variable: PATH=.;C:\GNU\mingw\4.8.2\x64_seh\bin;C:\GNU\mingw\4.8.2\x64_seh;C:\GNU\mingw\4.7.2\x32_dw2\bin;C:\GNU\mingw\4.7.2\x32_dw2;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\GNU\msys\bin;C:\GNU\gnuwin32\bin;D:\coding\lib\qt\4.8.5\x64_mingw-4.8.2_seh\bin;D:\coding\lib\opencv\2.4.6\x64_mingw-4.8.0_seh\bin;C:\GNU\perl\5.18.2\x64\site\bin;C:\GNU\perl\5.18.2\x64\bin;C:\GNU\python\2.7.5\x64;C:\Program Files\TortoiseSVN\bin;C:\Program Files\MATLAB\R2011b\runtime\win64;C:\Program Files\MATLAB\R2011b\bin;C:\Program Files\MiKTeX\miktex\bin\x64;C:\Program Files\Doxygen\bin;C:\Program Files (x86)\Nmap
[debug]Command-line: C:\GNU\mingw\4.8.2\x64_seh\bin\gdb.exe -nx -fullname -quiet -args D:/coding/projects/own/procpp/bin/Debug/procpp.exe
[debug]Working dir : D:\coding\projects\own\procpp
Starting debugger: C:\GNU\mingw\4.8.2\x64_seh\bin\gdb.exe -nx -fullname -quiet -args D:/coding/projects/own/procpp/bin/Debug/procpp.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from D:/coding/projects/own/procpp/bin/Debug/procpp.exe...
[debug]done.
[debug](gdb)
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.7
[debug]Copyright (C) 2014 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-w64-mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 7.7
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\GNU\codeblocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/coding/projects/own/procpp/
[debug]Source directories searched: D:/coding/projects/own/procpp;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break main
[debug]Breakpoint 2 at 0x401625: file D:\coding\projects\own\procpp\src\main.cpp, line 45.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: D:\coding\projects\own\procpp\bin\Debug\procpp.exe
Child process PID: 4716
[debug][New Thread 4716.0x11e8]
[debug]Breakpoint 2, main () at D:\coding\projects\own\procpp\src\main.cpp:45
[debug]D:\coding\projects\own\procpp\src\main.cpp:45:908:beg:0x401625
[debug]>>>>>>cb_gdb:
At D:\coding\projects\own\procpp\src\main.cpp:45
[debug]> bt 30
[debug]#0 main () at D:\coding\projects\own\procpp\src\main.cpp:45
[debug]>>>>>>cb_gdb:
[debug]> quit
Debugger finished with status 0
--- End code ---
scarphin:
Btw I tested 'shell' from gdb command line and it works.
WinterMute:
I assumed the "additional shell commands" were intended for the host shell rather than the gdb shell although I guess I could be wrong. If I add "shell start <file>" in the additional gdb commands then that works.
I'm using windows for this as well.
scarphin:
They are for the host shell, gdb executes them on whatever host it is launched. The 'additional shell commands' used to work in the past but somehow they don't anymore, at least on windows. I hope someone will look into it soon.
Inserting 'shell do something' into 'additional gdb commands' should be the same thing as inserting 'do something' into 'additional shell commands' but I prefer the latter to work again as it seems more convenient.
Navigation
[0] Message Index
[*] Previous page
Go to full version