I have a script file named simple
. I can run it using ./simple
and everything works fine as it should.
I need to run this file in GDB to back trace how one particular parameter is changed and by what functions is it called. when I try
(gdb) file simple
"/home/examples/simple": not in executable format: File format not recognized
(gdb) r simple
Starting program: simple
No executable file specified.
Use the "file" or "exec-file" command.`
How can I overcome this?
Bash provides extensive debugging features. The most common is to start up the subshell with the -x option, which will run the entire script in debug mode. Traces of each command plus its arguments are printed to standard output after the commands have been expanded but before they are executed.
GDB is debugger for compiled languages (like C/C++) not for shell scripts. If you need debug Bash script you can use -x
flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With