0

I want to pass command line arguments to sys.args (to a gdb python script). I saw this solution but would like pass arbitrary number of arguments. Like:

gdb --batch -x myScript.py 2 3 4 12 23 ..

myScript.py:

import gdb
import sys

print(sys.argv[1:])

Is is possible?

pmundt
  • 57
  • 9
  • Did you try it? – cdarke Dec 27 '17 at 14:51
  • It should work, but beware there are limits to the number of command-line arguments that can be passed, and those limits are implementation (including OS) dependant. – cdarke Dec 27 '17 at 14:59
  • I did try. Unfortunately, I get an error saying "excess command line arguments ignored". – pmundt Dec 27 '17 at 15:00
  • With `gdb` you specify the argument list to the `run` command. The `-x` statement is followed by a file containing `gdb` commands, not a python script. – cdarke Dec 27 '17 at 16:32

0 Answers0