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?

4
  • Did you try it? Commented Dec 27, 2017 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. Commented Dec 27, 2017 at 14:59
  • I did try. Unfortunately, I get an error saying "excess command line arguments ignored". Commented Dec 27, 2017 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. Commented Dec 27, 2017 at 16:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.