Seen with gdb on openSUSE, CentOS, Fedora, and Ubuntu:
This gdb was configured as “x86_64-unknown-linux-gnu”.
(gdb) p sizeof(void *)
$1 = 4
(gdb) p sizeof(long)
$2 = 4
Why is gdb giving me the wrong answers on all of my 64-bit systems?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems like gdb chooses some surprising defaults when you’re not debugging any particular piece of code. If you load up a 64-bit executable as in:
gdb /bin/shyou get a less-surprising result:You can also specifically tell gdb what to do: