How to view binary content of a C++ integer in gdb?

Viewed 2269
int main()
{
     int a = 0;
}

I compile: g++ -std=c++14 -g test.cpp

Run program in gdb:

gdb ./a.out

(gdb) break main

(gdb) run

(gdb) next

What I have tried:

(gdb) print /t &a

That prints 11111111111111111111111111111111101110101111100

That doesn't look like the right number, I was expecting 0000....0000. How can I print binary values from the memory location of the integer variable a ?

3 Answers
Related