public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/28235] New: [gdb/testsuite] Add dummy CUs before and after dwarf assembly
@ 2021-08-16 10:30 vries at gcc dot gnu.org
  2021-08-16 14:10 ` [Bug testsuite/28235] " simark at simark dot ca
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-16 10:30 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28235
           Summary: [gdb/testsuite] Add dummy CUs before and after dwarf
                    assembly
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Say one compiles a hello.c:
...
$ gcc -g hello.c
...

On openSUSE Leap 15.2 and Tumbleweed, the CU for hello.c is typically not the
first in .debug_info, nor the last.

On other systems, say ubuntu 18.04.5, the CU for hello.c is typically the first
and the last in .debug_info.

This difference has caused me to find some errors in the dwarf assembly using
openSUSE, that didn't show up on other platforms.

It occurred to me that we can also force this situation on other platforms by
doing:
...
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 52886d0701b..36316beebea 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2291,7 +2291,7 @@ namespace eval Dwarf {
        }

        set _output_file [open $filename w]
-       set _cu_count 0
+       set _cu_count -1
        _empty_array _deferred_output
        set _defer ""
        set _label_num 0
@@ -2304,11 +2304,17 @@ namespace eval Dwarf {

        set _debug_addr_index 0

+       cu {} {
+       }
+
        # Not "uplevel" here, because we want to evaluate in this
        # namespace.  This is somewhat bad because it means we can't
        # readily refer to outer variables.
        eval $body

+       cu {} {
+       }
+
        _write_deferred_output

        catch {close $_output_file}
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/28235] [gdb/testsuite] Add dummy CUs before and after dwarf assembly
  2021-08-16 10:30 [Bug testsuite/28235] New: [gdb/testsuite] Add dummy CUs before and after dwarf assembly vries at gcc dot gnu.org
@ 2021-08-16 14:10 ` simark at simark dot ca
  2021-08-23 10:08 ` cvs-commit at gcc dot gnu.org
  2021-08-23 10:11 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: simark at simark dot ca @ 2021-08-16 14:10 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
I think that's a good idea.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/28235] [gdb/testsuite] Add dummy CUs before and after dwarf assembly
  2021-08-16 10:30 [Bug testsuite/28235] New: [gdb/testsuite] Add dummy CUs before and after dwarf assembly vries at gcc dot gnu.org
  2021-08-16 14:10 ` [Bug testsuite/28235] " simark at simark dot ca
@ 2021-08-23 10:08 ` cvs-commit at gcc dot gnu.org
  2021-08-23 10:11 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-23 10:08 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5ef670d81fd222ae5edfa1428ad48710f5e10d35

commit 5ef670d81fd222ae5edfa1428ad48710f5e10d35
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Aug 23 12:08:25 2021 +0200

    [gdb/testsuite] Add dummy start and end CUs in dwarf assembly

    Say one compiles a hello.c:
    ...
    $ gcc -g hello.c
    ...

    On openSUSE Leap 15.2 and Tumbleweed, the CU for hello.c is typically not
the
    first in .debug_info, nor the last, due to presence of debug information in
    objects for sources like:
    - ../sysdeps/x86_64/start.S
    - init.c
    - ../sysdeps/x86_64/crti.S
    - elf-init.c
    - ../sysdeps/x86_64/crtn.S.

    On other systems, say ubuntu 18.04.5, the CU for hello.c is typically the
    first and the last in .debug_info.

    This difference has caused me to find some errors in the dwarf assembly
    using openSUSE, that didn't show up on other platforms.

    Force the same situation on other platforms by adding a dummy start
    and end CU.

    Tested on x86_64-linux.

    gdb/testsuite/ChangeLog:

    2021-08-22  Tom de Vries  <tdevries@suse.de>

            PR testsuite/28235
            * lib/dwarf.exp (Dwarf::dummy_cu): New proc.
            (Dwarf::assemble): Add dummy start and end CU.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/28235] [gdb/testsuite] Add dummy CUs before and after dwarf assembly
  2021-08-16 10:30 [Bug testsuite/28235] New: [gdb/testsuite] Add dummy CUs before and after dwarf assembly vries at gcc dot gnu.org
  2021-08-16 14:10 ` [Bug testsuite/28235] " simark at simark dot ca
  2021-08-23 10:08 ` cvs-commit at gcc dot gnu.org
@ 2021-08-23 10:11 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-23 10:11 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.1

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-08-23 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 10:30 [Bug testsuite/28235] New: [gdb/testsuite] Add dummy CUs before and after dwarf assembly vries at gcc dot gnu.org
2021-08-16 14:10 ` [Bug testsuite/28235] " simark at simark dot ca
2021-08-23 10:08 ` cvs-commit at gcc dot gnu.org
2021-08-23 10:11 ` vries at gcc dot gnu.org

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).