7

I use both GDB and DBX depending on the platform I'm debugging. I need to debug a tool where there are 20 command line parameters that need to be passed. GDB has an option where you can pass these parameters upon gdb startup:

gdb --args ...

I am looking for a similar way to do this in DBX. I'm hoping to save time rather than cutting and pasting all the time. I read parts of the manual, and I couldn't see a way to do this.

Jenner
  • 329
  • 3
  • 12
  • Huh. Haven't thought about DBX in 30 years. Since GDB runs on almost everything, any chance you can get/config/make/install? – Peter Rowell Jan 15 '13 at 02:16
  • No, we still have to live with SunStudio for a while, unless management here decides to transition Sun's compiler toward GDB. – Jenner Jan 15 '13 at 19:06
  • 2
    You could also put the arguments along with runargs into an external file and use: dbx -c ". external-file.ksh" – Chris Quenelle Feb 26 '13 at 03:48

2 Answers2

8

you can execute runargs command on startup

dbx -c "runargs --all --your --flags" a.out
Alexander Gorshenev
  • 2,769
  • 18
  • 33
  • Thanks for this! There is a caveat that your command line args must be less than 250 or 255 characters. This same limitation exists when you try to cut and paste command line args when using the "run" command. – Jenner Feb 22 '13 at 16:37
  • If you have a management insisting on using Sun Studio, then you probably have a support contact with Oracle? Just ask them to fix it. – Alexander Gorshenev Feb 22 '13 at 21:25
1

If you need to run app with name yourApp using dbx for debugging. For example: yourApp param1 param2

You can do it by using command run from dbx:

> dbx yourApp
Type 'help' for help.
reading symbolic information ...
(dbx) run param1 param2
      //some output made by yourApp
(dbx)
yaroslavpalamar
  • 368
  • 1
  • 5
  • 9