public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field
@ 2014-11-14  1:23 Petr Machata
  2014-11-15  9:02 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Machata @ 2014-11-14  1:23 UTC (permalink / raw)
  To: gdb-patches

Hi there,

playing with dwarf.exp I noticed a problem in generating Dwarf
compilation and type units with 64-bit offsets.  This patch fixes the
problem.  "make check" reports no regressions.

I don't have commit priviliges, so if this patch is acceptable, I'll
need someone else to commit this for me.

Thanks,
Petr

----8<----------------------------------------------------------------
Dwarf::tu and Dwarf::cu allow selection of units with 64-bit offsets
through an option.  When selected, unit size is encoded properly, but
offset to abbreviation unit is still encoded in a 4-byte field.

Reproducer:

Dwarf::assemble "blah.s" {
    tu {is_64 1 version 4 addr_size 8} 0x1122334455667788 the_type {
	type_unit {} { the_type: }
    }

    cu {is_64 1 version 4 addr_size 8} {
	compile_unit {{language @DW_LANG_C}} {}
    }
}

Signed-off-by: Petr Machata <pmachata@redhat.com>
---
 gdb/testsuite/ChangeLog     | 5 +++++
 gdb/testsuite/lib/dwarf.exp | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1edfc93..7f714a9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-14  Petr Machata  <pmachata@redhat.com>
+
+	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): In units with 64-bit
+	offsets, emit also abbrev offset as a 64-bit field.
+
 2013-10-21  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
 	PR gdb/15986
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index c28b986..ba734ab 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -820,7 +820,7 @@ namespace eval Dwarf {
 	}
 	define_label $start_label
 	_op .2byte $_cu_version Version
-	_op .4byte $my_abbrevs Abbrevs
+	_op .${_cu_offset_size}byte $my_abbrevs Abbrevs
 	_op .byte $_cu_addr_size "Pointer size"
 
 	_defer_output $_abbrev_section {
@@ -913,7 +913,7 @@ namespace eval Dwarf {
 	}
 	define_label $start_label
 	_op .2byte $_cu_version Version
-	_op .4byte $my_abbrevs Abbrevs
+	_op .${_cu_offset_size}byte $my_abbrevs Abbrevs
 	_op .byte $_cu_addr_size "Pointer size"
 	_op .8byte $signature Signature
 	if { $type_label != "" } {
-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field
  2014-11-14  1:23 [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field Petr Machata
@ 2014-11-15  9:02 ` Yao Qi
  2014-11-15 19:22   ` Petr Machata
  0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2014-11-15  9:02 UTC (permalink / raw)
  To: Petr Machata; +Cc: gdb-patches

Petr Machata <pmachata@redhat.com> writes:

> I don't have commit priviliges, so if this patch is acceptable, I'll
> need someone else to commit this for me.

The patch looks good to me.

> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index 1edfc93..7f714a9 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2014-11-14  Petr Machata  <pmachata@redhat.com>
> +
> +	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): In units with 64-bit
> +	offsets, emit also abbrev offset as a 64-bit field.

Your changelog entry doesn't describe what the change is.  How about this?

	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): Emit
        ${_cu_offset_size} bytes abbrev offset.

I'll commit the patch for you if you are happy with the updated changelog.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field
  2014-11-15  9:02 ` Yao Qi
@ 2014-11-15 19:22   ` Petr Machata
  2014-11-17  0:40     ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Machata @ 2014-11-15 19:22 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <yao@codesourcery.com> writes:

>> +2014-11-14  Petr Machata  <pmachata@redhat.com>
>> +
>> +	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): In units with 64-bit
>> +	offsets, emit also abbrev offset as a 64-bit field.
>
> Your changelog entry doesn't describe what the change is.  How about this?
>
> 	* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): Emit
>         ${_cu_offset_size} bytes abbrev offset.
>
> I'll commit the patch for you if you are happy with the updated changelog.

I am.

Thanks,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field
  2014-11-15 19:22   ` Petr Machata
@ 2014-11-17  0:40     ` Yao Qi
  0 siblings, 0 replies; 4+ messages in thread
From: Yao Qi @ 2014-11-17  0:40 UTC (permalink / raw)
  To: Petr Machata; +Cc: gdb-patches

Petr Machata <pmachata@redhat.com> writes:

>> I'll commit the patch for you if you are happy with the updated changelog.
>
> I am.

OK, patch below is what I pushed in.

-- 
Yao (齐尧)

From: Petr Machata <pmachata@redhat.com>
Date: Mon, 17 Nov 2014 08:31:47 +0800
Subject: [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field

Dwarf::tu and Dwarf::cu allow selection of units with 64-bit offsets
through an option.  When selected, unit size is encoded properly, but
offset to abbreviation unit is still encoded in a 4-byte field.  This
patch fixes the problem.

Reproducer:

Dwarf::assemble "blah.s" {
    tu {is_64 1 version 4 addr_size 8} 0x1122334455667788 the_type {
	type_unit {} { the_type: }
    }

    cu {is_64 1 version 4 addr_size 8} {
	compile_unit {{language @DW_LANG_C}} {}
    }
}

gdb/testsuite:

	* lib/dwarf.exp  (Dwarf::cu, Dwarf::tu): Emit
	${_cu_offset_size} bytes abbrev offset.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 65687c0..2a027d5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-17  Petr Machata  <pmachata@redhat.com>
+
+	* lib/dwarf.exp  (Dwarf::cu, Dwarf::tu): Emit
+	${_cu_offset_size} bytes abbrev offset.
+
 2014-11-15  Doug Evans  <xdje42@gmail.com>
 
 	PR symtab/17559
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index cadda3e..778ad1c 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -954,7 +954,7 @@ namespace eval Dwarf {
 	}
 	define_label $start_label
 	_op .2byte $_cu_version Version
-	_op .4byte $my_abbrevs Abbrevs
+	_op .${_cu_offset_size}byte $my_abbrevs Abbrevs
 	_op .byte $_cu_addr_size "Pointer size"
 
 	_defer_output $_abbrev_section {
@@ -1047,7 +1047,7 @@ namespace eval Dwarf {
 	}
 	define_label $start_label
 	_op .2byte $_cu_version Version
-	_op .4byte $my_abbrevs Abbrevs
+	_op .${_cu_offset_size}byte $my_abbrevs Abbrevs
 	_op .byte $_cu_addr_size "Pointer size"
 	_op .8byte $signature Signature
 	if { $type_label != "" } {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-17  0:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14  1:23 [PATCH] dwarf.exp: In 64-bit units, emit also abbrev offset as a 64-bit field Petr Machata
2014-11-15  9:02 ` Yao Qi
2014-11-15 19:22   ` Petr Machata
2014-11-17  0:40     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).