[Bug gdb/24515] New: FAIL: gdb.dwarf2/varval.exp: print varval2

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] New: FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

            Bug ID: 24515
           Summary: FAIL: gdb.dwarf2/varval.exp: print varval2
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

If I build gdb with -fsanitize=address and run tests with "export
ASAN_OPTIONS=detect_leaks=0", I run into this failure in gdb.dwarf2/varval.exp:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...

In more detail:
...
Breakpoint 1, 0x00000000004004ab in main ()^M
(gdb) print varval^M
$1 = 8^M
(gdb) PASS: gdb.dwarf2/varval.exp: print varval
print varval2^M
value has been optimized out^M
(gdb) FAIL: gdb.dwarf2/varval.exp: print varval2
print constval^M
$2 = 53^M
(gdb) PASS: gdb.dwarf2/varval.exp: print constval
...

With a gdb build without -fsanitize=address, I get instead:
...
Breakpoint 1, 0x00000000004004ab in main ()^M
(gdb) print varval^M
$1 = 8^M
(gdb) PASS: gdb.dwarf2/varval.exp: print varval
print varval2^M
$2 = 8^M
(gdb) PASS: gdb.dwarf2/varval.exp: print varval2
print constval^M
$3 = 53^M
(gdb) PASS: gdb.dwarf2/varval.exp: print constval
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This also fails with cc-with-gdb-index, see PR24516.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 11841
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11841&action=edit
debug patch

With this debug patch (and with executable varval2, which is varval minimized
to this FAIL), I see without -readnow:
...
$ ./gdb  -batch -ex "start" -ex "p varval2"
build/gdb/testsuite/outputs/gdb.dwarf2/varval2/varval2        
storing mapping abstract_to_concrete[0xdb] == 0x110
storing mapping abstract_to_concrete[0x0x26d5ee0] == 0x26d6020
Temporary breakpoint 1 at 0x4004ab

Temporary breakpoint 1, 0x00000000004004ab in main ()
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x26d5ee0x
found mapping for abstract 0xdb
looking for match for pc 0x4004ab
pc low 0x4004a7 high 0x4004b2, found match
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x26d5ee0x
found mapping for abstract 0xdb
looking for match for pc 0x4004ab
pc low 0x4004a7 high 0x4004b2, found match
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x26d5ee0x
found mapping for abstract 0xdb
looking for match for pc 0x4004ab
pc low 0x4004a7 high 0x4004b2, found match
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x26d5ee0x
found mapping for abstract 0xdb
looking for match for pc 0x4004ab
pc low 0x4004a7 high 0x4004b2, found match
$1 = 8
...

and with -readnow:
...
$ ./gdb -readnow  -batch -ex "start" -ex "p varval2"
build/gdb/testsuite/outputs/gdb.dwarf2/varval2/varval2
storing mapping abstract_to_concrete[0xdb] == 0x110
storing mapping abstract_to_concrete[0x0x22b0650] == 0x22b0790
Temporary breakpoint 1 at 0x4004ab

Temporary breakpoint 1, 0x00000000004004ab in main ()
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x239f860x
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x239f860x
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x239f860x
looking for mapping for abstract 0xdb
looking for mapping for abstract 0x239f860x
value has been optimized out
...

AFAIU, the problem is the data structure:
...
  std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>                  
...
which stores pointers. We should probably be storing sect_off instead of
pointers.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 11842
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11842&action=edit
Tentative patch

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> Created attachment 11842 [details]
> Tentative patch

This tentative patch fixes:
- varval.exp with readnow board (PR24521)
- varval.exp with cc-with-gdb-index/cc-with-debug-names boards (PR24516)
- problem reported in comment 0

It does not fix PR24591.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch submitted: https://sourceware.org/ml/gdb-patches/2019-06/msg00327.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

--- Comment #6 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 <[hidden email]>:

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

commit 3360b6e7963e3c579e50078e78d226ea63e2960f
Author: Tom de Vries <[hidden email]>
Date:   Tue Jun 18 18:59:51 2019 +0200

    [gdb] Fix abstract_to_concrete type

    The test-case varval.exp fails here:
    ...
    FAIL: gdb.dwarf2/varval.exp: print varval2
    ...
    with boards readnow/cc-with-gdb-index/cc-with-debug-names, as well as if
gdb
    is build with -fsanitize=address -lasan.

    The problem is that the abstract_to_concrete map in which we track the
    association of abstract to concrete DIEs (for DW_OP_GNU_variable_value
    support) has type std::unordered_map<die_info_ptr,
std::vector<die_info_ptr>>,
    and the die_info_ptrs that we register in the map may be invalid by the
time
    that we start to lookup DIEs in the map.

    Fix this by using the sect_offset instead to identify the DIEs in the map.

    Build and tested on x86_64-linux.

    gdb/ChangeLog:

    2019-06-18  Tom de Vries  <[hidden email]>

        PR gdb/24515
        * dwarf2read.h (abstract_to_concrete): Change type from
        std::unordered_map<die_info_ptr, std::vector<die_info_ptr>> to
        std::unordered_map<sect_offset, std::vector<sect_offset>>.
        * dwarf2read.c (read_variable): Update.
        (dwarf2_fetch_die_loc_sect_off): Update.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24515] FAIL: gdb.dwarf2/varval.exp: print varval2

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24515

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 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.