* [patch] dwarf2read.c (partial_read_comp_unit_head) cleanup
@ 2011-09-12 19:06 Doug Evans
2011-10-12 16:11 ` Jan Kratochvil
0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2011-09-12 19:06 UTC (permalink / raw)
To: gdb-patches
Hi.
There may have been a reason in the past to not have
partial_read_comp_unit_head set offset,first_die_offset
but I can't think of one now.
I will check this in in a few days if there are no objections.
2011-09-12 Doug Evans <dje@google.com>
* dwarf2read.c (partial_read_comp_unit_head): Set header->offset,
header->first_die_offset here. All callers updated.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.560
diff -u -p -r1.560 dwarf2read.c
--- dwarf2read.c 9 Sep 2011 19:41:13 -0000 1.560
+++ dwarf2read.c 12 Sep 2011 18:29:28 -0000
@@ -2268,7 +2268,7 @@ dw2_get_file_names (struct objfile *objf
struct cleanup *cleanups;
struct die_info *comp_unit_die;
struct dwarf2_section_info* sec;
- gdb_byte *beg_of_comp_unit, *info_ptr, *buffer;
+ gdb_byte *info_ptr, *buffer;
int has_children, i;
struct dwarf2_cu cu;
unsigned int bytes_read, buffer_size;
@@ -2295,16 +2295,11 @@ dw2_get_file_names (struct objfile *objf
buffer_size = sec->size;
buffer = sec->buffer;
info_ptr = buffer + this_cu->offset;
- beg_of_comp_unit = info_ptr;
info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
buffer, buffer_size,
abfd);
- /* Complete the cu_header. */
- cu.header.offset = beg_of_comp_unit - buffer;
- cu.header.first_die_offset = info_ptr - beg_of_comp_unit;
-
this_cu->cu = &cu;
cu.per_cu = this_cu;
@@ -2940,6 +2935,8 @@ read_comp_unit_head (struct comp_unit_he
return info_ptr;
}
+/* Read in a CU header and perform some basic error checking. */
+
static gdb_byte *
partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
gdb_byte *buffer, unsigned int buffer_size,
@@ -2947,8 +2944,12 @@ partial_read_comp_unit_head (struct comp
{
gdb_byte *beg_of_comp_unit = info_ptr;
+ header->offset = beg_of_comp_unit - buffer;
+
info_ptr = read_comp_unit_head (header, info_ptr, abfd);
+ header->first_die_offset = info_ptr - beg_of_comp_unit;
+
if (header->version != 2 && header->version != 3 && header->version != 4)
error (_("Dwarf Error: wrong version in compilation unit header "
"(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
@@ -3334,10 +3335,6 @@ process_psymtab_comp_unit (struct objfil
buffer, buffer_size,
abfd);
- /* Complete the cu_header. */
- cu.header.offset = beg_of_comp_unit - buffer;
- cu.header.first_die_offset = info_ptr - beg_of_comp_unit;
-
cu.list_in_scope = &file_symbols;
/* If this compilation unit was already read in, free the
@@ -3598,7 +3595,7 @@ load_partial_comp_unit (struct dwarf2_pe
struct objfile *objfile)
{
bfd *abfd = objfile->obfd;
- gdb_byte *info_ptr, *beg_of_comp_unit;
+ gdb_byte *info_ptr;
struct die_info *comp_unit_die;
struct dwarf2_cu *cu;
struct cleanup *free_abbrevs_cleanup, *free_cu_cleanup = NULL;
@@ -3610,7 +3607,6 @@ load_partial_comp_unit (struct dwarf2_pe
gdb_assert (dwarf2_per_objfile->info.readin);
info_ptr = dwarf2_per_objfile->info.buffer + this_cu->offset;
- beg_of_comp_unit = info_ptr;
if (this_cu->cu == NULL)
{
@@ -3627,10 +3623,6 @@ load_partial_comp_unit (struct dwarf2_pe
dwarf2_per_objfile->info.size,
abfd);
- /* Complete the cu_header. */
- cu->header.offset = this_cu->offset;
- cu->header.first_die_offset = info_ptr - beg_of_comp_unit;
-
/* Link this compilation unit into the compilation unit tree. */
this_cu->cu = cu;
cu->per_cu = this_cu;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] dwarf2read.c (partial_read_comp_unit_head) cleanup
2011-09-12 19:06 [patch] dwarf2read.c (partial_read_comp_unit_head) cleanup Doug Evans
@ 2011-10-12 16:11 ` Jan Kratochvil
2011-10-12 16:29 ` Doug Evans
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2011-10-12 16:11 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Mon, 12 Sep 2011 20:34:16 +0200, Doug Evans wrote:
> I will check this in in a few days if there are no objections.
>
> 2011-09-12 Doug Evans <dje@google.com>
>
> * dwarf2read.c (partial_read_comp_unit_head): Set header->offset,
> header->first_die_offset here. All callers updated.
FYI I was checking this patch and I find it correct.
Thanks,
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] dwarf2read.c (partial_read_comp_unit_head) cleanup
2011-10-12 16:11 ` Jan Kratochvil
@ 2011-10-12 16:29 ` Doug Evans
0 siblings, 0 replies; 3+ messages in thread
From: Doug Evans @ 2011-10-12 16:29 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On Wed, Oct 12, 2011 at 9:10 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Mon, 12 Sep 2011 20:34:16 +0200, Doug Evans wrote:
>> I will check this in in a few days if there are no objections.
>>
>> 2011-09-12 Doug Evans <dje@google.com>
>>
>> * dwarf2read.c (partial_read_comp_unit_head): Set header->offset,
>> header->first_die_offset here. All callers updated.
>
> FYI I was checking this patch and I find it correct.
Thanks, committed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-12 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12 19:06 [patch] dwarf2read.c (partial_read_comp_unit_head) cleanup Doug Evans
2011-10-12 16:11 ` Jan Kratochvil
2011-10-12 16:29 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox