7

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?

Guy Avraham
  • 3,482
  • 3
  • 38
  • 50
unix_kid
  • 351
  • 2
  • 5
  • 9
  • possible duplicate of [How to debug a bash script?](http://stackoverflow.com/questions/951336/how-to-debug-a-bash-script) – Hauleth Sep 23 '13 at 11:59

1 Answers1

4

GDB is debugger for compiled languages (like C/C++) not for shell scripts. If you need debug Bash script you can use -x flag.

Hauleth
  • 22,873
  • 4
  • 61
  • 112
  • 1
    Thank you.. i know thar GDB is for languages like c/c++.but my question was how can i change my .sh file to run it in GDB. anyhow, I just had to make a small change in my script file.. it is working fine now.. thank you once again.. – unix_kid Sep 23 '13 at 11:57