This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The 'x' command: size problem


On Tuesday 06 September 2005 19:06, Paul Koning wrote:
> p/x packet
>
> will do the job.
>
> Or if you need to refer to some hex address and interpret it as the
> data:
>
> 	p/x *(struct packet *) 0x12342324

Good, but:

1. The output format of 'p' is very different from that of 'x'.
Given that I use 'x' for general case of 'print 1000 bytes starting at 
0x12345678', I'll have to detect when to use 'p', and when to parse output of 
'p', not output of 'x'.

2. What if user wants to see 5*sizeof(packet) bytes of memory from a given 
address?

   p/x (*(packet*)0x12345678)@5

will work but would require extra code to get that from "5*sizeof(packet)", 
would require extra code to parse output, and what about even more complex 
case of "sizeof(first_packet) + 5*sizeof(packet)"?

- Volodya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]