* [RFC] register_to_value/value_to_register arguments?
@ 2012-06-11 9:37 Maciej W. Rozycki
2012-06-11 16:13 ` Eli Zaretskii
2012-06-12 15:32 ` Tom Tromey
0 siblings, 2 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2012-06-11 9:37 UTC (permalink / raw)
To: gdb-patches
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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] register_to_value/value_to_register arguments?
2012-06-11 9:37 [RFC] register_to_value/value_to_register arguments? Maciej W. Rozycki
@ 2012-06-11 16:13 ` Eli Zaretskii
2012-06-12 15:32 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2012-06-11 16:13 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: gdb-patches
> Date: Mon, 11 Jun 2012 10:36:30 +0100
> From: "Maciej W. Rozycki" <macro@codesourcery.com>
>
> 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.
This patch is OK, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] register_to_value/value_to_register arguments?
2012-06-11 9:37 [RFC] register_to_value/value_to_register arguments? Maciej W. Rozycki
2012-06-11 16:13 ` Eli Zaretskii
@ 2012-06-12 15:32 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2012-06-12 15:32 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: gdb-patches
>>>>> "Maciej" == Maciej W Rozycki <macro@codesourcery.com> writes:
Maciej> However this rises a question: it is relatively expensive to
Maciej> retrieve gdbarch from frame, most target implementations of
Maciej> these methods need it and it is already readily available to the
Maciej> caller (retrieved from the very frame) -- wouldn't it therefore
Maciej> make sense to pass it along frame?
It seems to me that the frame's arch is cached, so retrieving it is only
expensive the first time. Given that, the current approach is clearer
and safer, since there's no possibility of arguments being out of sync.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-12 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 9:37 [RFC] register_to_value/value_to_register arguments? Maciej W. Rozycki
2012-06-11 16:13 ` Eli Zaretskii
2012-06-12 15:32 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox