
Appendix E. The GDB Agent Expression Mechanism
361
adbg_find_memory_in_frame (f, (char*) 0x8000, &buffer, &size)
This would set
buffer
to
0x1000
, set
size
to sixteen, and return
OK_TARGET_RESPONSE
,
since
f
saves sixteen bytes from
0x8000
at
0x1000
.
adbg_find_memory_in_frame (f, (char *) 0x8004, &buffer, &size)
This would set
buffer
to
0x1004
, set
size
to twelve, and return
OK_TARGET_RESPONSE
, since
f
saves the twelve bytes from
0x8004
starting four bytes into the buffer at
0x1000
. This shows
that request addresses may fall in the middle of saved areas; the function should return the address
and size of the remainder of the buffer.
adbg_find_memory_in_frame (f, (char *) 0x8100, &buffer, &size)
This would set
size
to
0x3f00
and return
NOT_FOUND_TARGET_RESPONSE
, since there is no
memory saved in
f
from the address
0x8100
, and the next memory available is at
0x3f00
, or
0xc000
. This shows that request addresses may fall outside of all saved memory
ranges; the function should indicate the next saved area, if any.
adbg_find_memory_in_frame (f, (char *) 0x7000, &buffer, &size)
This would set
size
to
0x1000
and return
NOT_FOUND_TARGET_RESPONSE
, since the next
saved memory is at
0x1000
, or
0x8000
.
adbg_find_memory_in_frame (f, (char *) 0xf000, &buffer, &size)
This would set
size
to zero, and return
NOT_FOUND_TARGET_RESPONSE
. This shows how the
function tells the caller that no further memory ranges have been saved.
As another example, here is a function which will print out the addresses of all memory saved in the
trace frame
frame
on the Symmetrix INLINES console:
void
print_frame_addresses (FRAME_DEF *frame)
{
char *addr;
char *buffer;
unsigned long size;
addr = 0;
for (;;)
{
/* Either find out how much memory we have here, or discover
where the next saved region is.
*/
if (adbg_find_memory_in_frame (frame, addr, &buffer, &size)
== OK_TARGET_RESPONSE)
printp ("saved %x to %x\n", addr, addr + size);
if (size == 0)
break;
addr += size;
}
}
Note that there is not necessarily any connection between the order in which the data is saved in
the trace frame, and the order in which
adbg_find_memory_in_frame
will return those memory
ranges. The code above will always print the saved memory regions in order of increasing address,
while the underlying frame structure might store the data in a random order.
[[This section should cover the rest of the Symmetrix functions the stub relies upon, too.]]
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......