Joel alexis
Joel alexis

Reputation: 43

What is <main+x> in gdb output?

What is <main+8> saying here? I'm working on a book and I don't think I've missed it. I've looked online but haven't found an answer...

(gdb) i r $rip
rip            0x5555555546b2    
0x5555555546b2 <main+8>

Upvotes: 1

Views: 69

Answers (1)

Jean-Fran&#231;ois Fabre
Jean-Fran&#231;ois Fabre

Reputation: 140256

the debugger prints the raw address, then tries to print the symbol associated to this address (when symbol table is available)

If it doesn't find one, it goes back to the closest known symbol, which occurs to be main here, and adds the actual offset. Helpful most of the time, since the address often relates to the quoted symbol (often seen in branch addresses).

Upvotes: 5

Related Questions