Add DW_TAG_compile_unit DIE to Dummy CUs

Message ID 20240417145151.471198-1-hawkinsw@obs.cr
State Dropped, archived
Headers
Series Add DW_TAG_compile_unit DIE to Dummy CUs |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Will Hawkins April 17, 2024, 2:51 p.m. UTC
  Dummy CUs help detect errors and are very helpful. However, the DWARF
spec seems to indicate the CUs need a DW_TAG_compile_unit in addition to
the header. This patch adds that.

See
https://sourceware.org/bugzilla/show_bug.cgi?id=31650

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
---
 gdb/testsuite/lib/dwarf.exp | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Simon Marchi April 17, 2024, 2:55 p.m. UTC | #1
On 2024-04-17 10:51, Will Hawkins wrote:
> Dummy CUs help detect errors and are very helpful. However, the DWARF
> spec seems to indicate the CUs need a DW_TAG_compile_unit in addition to
> the header. This patch adds that.
> 
> See
> https://sourceware.org/bugzilla/show_bug.cgi?id=31650

Write this as a git trailer:

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31650

The patch seems fine to me, but I'll let Tom de Vries check it, since he
wrote that code.

Simon
  
Will Hawkins April 17, 2024, 3:21 p.m. UTC | #2
On Wed, Apr 17, 2024 at 10:55 AM Simon Marchi <simark@simark.ca> wrote:
>
>
>
> On 2024-04-17 10:51, Will Hawkins wrote:
> > Dummy CUs help detect errors and are very helpful. However, the DWARF
> > spec seems to indicate the CUs need a DW_TAG_compile_unit in addition to
> > the header. This patch adds that.
> >
> > See
> > https://sourceware.org/bugzilla/show_bug.cgi?id=31650
>
> Write this as a git trailer:
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31650
>

Thank you! I will spin a v2! I appreciate the correction!

> The patch seems fine to me, but I'll let Tom de Vries check it, since he
> wrote that code.
>
> Simon
  

Patch

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index c694375b534..1a97f83f8e6 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2999,6 +2999,7 @@  namespace eval Dwarf {
     proc dummy_cu {} {
 	# Generate a CU with default options and empty body.
 	cu {label dummy_cu} {
+	  compile_unit {}
 	}
 
 	# Generate an .debug_aranges entry for the dummy CU.