25

I would like to know how it is possible to know the current system architecture in GDB and store this information into a variable for later evaluation.

Something like:

set variable $x=`shell uname -m`

1 Answer 1

22

theres 2 ways:

the older way:

(gdb) shell echo set \$x=\"$(uname -m)\" >/tmp/foo.gdb
(gdb) source /tmp/foo.gdb

newer with python:

(gdb) python gdb.execute("set $y=\"" + os.uname()[4] + "\"")
Sign up to request clarification or add additional context in comments.

1 Comment

@hellow I don't believe so, but not positive, however there is this patch, most recently updated yesterday, which is undergoing review, try it out! sourceware.org/ml/gdb-patches/2019-05/msg00130.html

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.