[RFC] register_to_value/value_to_register arguments?

Maciej W. Rozycki
2012-06-11T09:37:06Z

Hello,

While doing some changes recently I have come across this inconsistency
in our internal document when it comes to register_to_value and
value_to_register gdbarch method arguments (patch below).

However this rises a question: it is relatively expensive to retrieve
gdbarch from frame, most target implementations of these methods need it
and it is already readily available to the caller (retrieved from the very
frame) -- wouldn't it therefore make sense to pass it along frame? Why
wasn't it done like this when the API was changed according to this
documentation patch?

Maciej

2012-06-11 Maciej W. Rozycki <macro@codesourcery.com>

gdb/doc/
* gdbint.texinfo (Using Different Register and Memory Data
Representations): Update gdbarch_register_to_value and
gdbarch_value_to_register arguments.

gdb-doc-gdbint-regconv.diff
Index: gdb-fsf-trunk-quilt/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/doc/gdbint.texinfo 2012-06-01 18:42:43.205559049 +0100
+++ gdb-fsf-trunk-quilt/gdb/doc/gdbint.texinfo 2012-06-11 10:17:24.713600380 +0100
@@ -3726,7 +3726,7 @@ If defined, this function should return
type, when no conversion is necessary.
@end deftypefn

-@deftypefn {Architecture Function} void gdbarch_register_to_value (struct gdbarch *@var{gdbarch}, int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})
+@deftypefn {Architecture Function} void gdbarch_register_to_value (struct gdbarch *@var{gdbarch}, struct frame_info *@var{frame}, int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})

Convert the value of register number @var{reg} to a data object of
type @var{type}. The buffer at @var{from} holds the register's value
@@ -3745,7 +3745,7 @@ non-zero value.

@end deftypefn

-@deftypefn {Architecture Function} void gdbarch_value_to_register (struct gdbarch *@var{gdbarch}, struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})
+@deftypefn {Architecture Function} void gdbarch_value_to_register (struct gdbarch *@var{gdbarch}, struct frame_info *@var{frame}, struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})

Convert a data value of type @var{type} to register number @var{reg}'
raw format.