0

When I want to run python into gdb I using

source /tmp/gdb/tmp/parser.py

  1. Can I set an alias so in the next time I want to call this script I use only parser.py or parser (without setting the script into working directory
  2. How can I pass args to script ? source /tmp/gdb/tmp/parser.py <args1> doesn't work
1
  • Instead of sourcing the script multiple times, you could create a function in the script, source it one time, and call the function as many times as you want (with arguments). Commented Jan 22, 2021 at 16:18

1 Answer 1

0

These should have been asked as two separate questions, really. But:

  1. Execute command dir /tmp/gdb/tmp/, after that you should be able to run script as source parser.py
  2. You can't when you are sourcing a script. Rewrite script so that it attaches itself as GDB command via class inheriting from gdb.Command. The command can accept arguments. And you will save on typing source ... too.
Sign up to request clarification or add additional context in comments.

Comments

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.