user1060517
user1060517

Reputation: 375

convert hex ip address to dotted decimal in GDB

I am using GDB to debug C code, I see ip address been shown as -

npc_srcip = 0x7fa06e7fd430, npc_dstip = 0x7fa06e7fd434. What is the way to convert this to decimal dotted format?

Upvotes: 0

Views: 908

Answers (1)

Jester
Jester

Reputation: 58792

These look like pointers because they are bigger than 32 bit. You will want to dereference them probably. Then convert each byte from hex to decimal and you got your ip address. That is something like: x/4ub npc_srcip should give you the parts.

Upvotes: 2

Related Questions