This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
target memory read/write methods
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb at sources dot redhat dot com
- Date: Sat, 17 Jun 2006 16:25:58 +0400
- Subject: target memory read/write methods
Hello!
I was looking at target memory read/write methods in target.{c,h}, and noted
some inconsistency.
One way to read a memory is:
- target_read_memory, which calls
- xfer_using_stratum, which calls
- target_xfer_partial (iterating over 'stratums'), which
- goes to function pointer in target_ops
This is the predominant method.
Another way to read memory is:
- get_target_memory{unsigned}, which calls:
- target_read, which calls:
- target_xfer_partial
This last method is a bit suspect:
- It does not iterates over 'stratums'
- It's used in just two places:
- frv-tdep.c (two calls in the same function)
- ppc-linux-tdep.c (one call)
In both frv-tdep.c, the get_target_memory_unsigned function is called inside
'convert_from_func_ptr_addr' arch method and everywhere that one is called,
¤t_target is passed to it.
Would it be reasonable to change those three calls to use
'target_read_memory', and the remove 'get_target_memory{_unsigned}' and
'target_read' which would be unused.
Anything I'm missing?
- Volodya