* [RFA] read_reg() patch
@ 2004-07-20 19:17 Martin M. Hunt
2004-07-21 20:36 ` Mark Kettenis
0 siblings, 1 reply; 4+ messages in thread
From: Martin M. Hunt @ 2004-07-20 19:17 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
2004-07-20 Kevin Buettner and Martin Hunt <hunt@redhat.com>
* dwarf2-frame.c (read_reg): Add a call to
store_unsigned_integer.
This extracts the least significant register_size() bits and
extends it to the size of a pointer. Without this, big-endian
targets where pointer size != register size breaks.
--
Martin M. Hunt <hunt@redhat.com>
Red Hat Inc.
[-- Attachment #2: read_reg.patch --]
[-- Type: text/x-patch, Size: 641 bytes --]
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.36
diff -w -u -r1.36 dwarf2-frame.c
--- dwarf2-frame.c 15 Jun 2004 01:04:19 -0000 1.36
+++ dwarf2-frame.c 20 Jul 2004 18:54:54 -0000
@@ -214,6 +214,8 @@
buf = (char *) alloca (register_size (gdbarch, regnum));
frame_unwind_register (next_frame, regnum, buf);
+ store_unsigned_integer (buf, TYPE_LENGTH (builtin_type_void_data_ptr),
+ extract_unsigned_integer (buf, register_size (gdbarch, regnum)));
return extract_typed_address (buf, builtin_type_void_data_ptr);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] read_reg() patch
2004-07-20 19:17 [RFA] read_reg() patch Martin M. Hunt
@ 2004-07-21 20:36 ` Mark Kettenis
2004-07-26 20:57 ` Martin M. Hunt
0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2004-07-21 20:36 UTC (permalink / raw)
To: hunt; +Cc: gdb-patches
From: "Martin M. Hunt" <hunt@redhat.com>
Date: Tue, 20 Jul 2004 12:16:51 -0700
2004-07-20 Kevin Buettner and Martin Hunt <hunt@redhat.com>
* dwarf2-frame.c (read_reg): Add a call to
store_unsigned_integer.
This extracts the least significant register_size() bits and
extends it to the size of a pointer. Without this, big-endian
targets where pointer size != register size breaks.
The formatting of this ChangeLog entry isn't right. Please look at
the existing ChangeLogs to see how you should write them. Also move
the explanation of what the code does to the code. The ChangeLog
should just say what's changed, not why.
I also think that the code itself is pretty unreadable. There are too
many nested function calls. I think it could be improved by using a
(temporary) local variable to store the result of
extract_unsigned_integer().
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] read_reg() patch
2004-07-21 20:36 ` Mark Kettenis
@ 2004-07-26 20:57 ` Martin M. Hunt
2004-07-29 22:48 ` Mark Kettenis
0 siblings, 1 reply; 4+ messages in thread
From: Martin M. Hunt @ 2004-07-26 20:57 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 357 bytes --]
> I also think that the code itself is pretty unreadable. There are too
> many nested function calls. I think it could be improved by using a
> (temporary) local variable to store the result of
> extract_unsigned_integer().
How's this?
2004-07-26 Martin Hunt <hunt@redhat.com>
* dwarf2-frame.c (read_reg): Add a call to
store_unsigned_integer.
[-- Attachment #2: read_reg.patch --]
[-- Type: text/x-patch, Size: 1039 bytes --]
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.38
diff -u -p -r1.38 dwarf2-frame.c
--- dwarf2-frame.c 23 Jul 2004 22:05:20 -0000 1.38
+++ dwarf2-frame.c 26 Jul 2004 20:54:39 -0000
@@ -209,11 +209,20 @@ read_reg (void *baton, int reg)
struct gdbarch *gdbarch = get_frame_arch (next_frame);
int regnum;
char *buf;
+ CORE_ADDR tmp;
regnum = DWARF2_REG_TO_REGNUM (reg);
buf = (char *) alloca (register_size (gdbarch, regnum));
frame_unwind_register (next_frame, regnum, buf);
+
+ /* This extracts the least significant register_size() bits and
+ extends it to the size of a pointer. Without this, big-endian
+ targets where pointer size != register size breaks. */
+ tmp = extract_unsigned_integer (buf, register_size (gdbarch, regnum));
+ store_unsigned_integer (buf, TYPE_LENGTH (builtin_type_void_data_ptr),
+ tmp);
+
return extract_typed_address (buf, builtin_type_void_data_ptr);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] read_reg() patch
2004-07-26 20:57 ` Martin M. Hunt
@ 2004-07-29 22:48 ` Mark Kettenis
0 siblings, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2004-07-29 22:48 UTC (permalink / raw)
To: hunt; +Cc: gdb-patches
From: "Martin M. Hunt" <hunt@redhat.com>
Date: Mon, 26 Jul 2004 13:57:34 -0700
> I also think that the code itself is pretty unreadable. There are too
> many nested function calls. I think it could be improved by using a
> (temporary) local variable to store the result of
> extract_unsigned_integer().
How's this?
2004-07-26 Martin Hunt <hunt@redhat.com>
* dwarf2-frame.c (read_reg): Add a call to
store_unsigned_integer.
Great, although I'd chose a somewhat less generic name for the
variable than `tmp'; although the `val' I've got in mind is pretty
generic too :-(. However, the type shouldn't be CORE_ADDR, but
ULONGEST. Consider a patch with that change pre-approved.
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-29 22:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-20 19:17 [RFA] read_reg() patch Martin M. Hunt
2004-07-21 20:36 ` Mark Kettenis
2004-07-26 20:57 ` Martin M. Hunt
2004-07-29 22:48 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox