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]

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,
&current_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










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