public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26336] New: corefile.exp regression for unix/-m32 on x86_64
@ 2020-08-04  3:20 kevinb at redhat dot com
  2020-08-04  3:21 ` [Bug gdb/26336] " kevinb at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kevinb at redhat dot com @ 2020-08-04  3:20 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26336
           Summary: corefile.exp regression for unix/-m32 on x86_64
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: kevinb at redhat dot com
  Target Milestone: ---

Overview:

gdb.base/corefile.exp is showing an unexpected failure and an unresolved
testcase when testing against unix/-m32.

Steps to Reproduce:

1) Fetch and build upstream GDB sources in the normal fashion for x86_64.

2) Test using the following command:

make check RUNTESTFLAGS="--target_board unix/-m32" TESTS="gdb.base/corefile.exp

Actual Results:

                === gdb Summary ===

# of expected passes            28
# of unexpected failures        1
# of unresolved testcases       1


Expected Results:

                === gdb Summary ===

# of expected passes            30

Build Date & Hardware:

I first noticed this problem on July 29, 2020.

Hardware is x86_64 VMs running on an x86_64 virtualization host.  I've
reproduced this problem using Fedora 28, 29, 31, and 32.

Additional Information:

I've isolated the commit which first caused the regression:

>From 5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 10 Jan 2020 20:06:08 +0000
Subject: [PATCH] Multi-target support

Below is the relevant portion of the log file. Once -m32 binaries and corefile
are created, the sequence shown below (with a suitable pid for the attach) may
be used to reproduce the problem when running GDB by hand.

spawn
/mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/outputs/gdb.base/corefile/corefile
sleep
spawn /mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/../../gdb/gdb -nw
-nx -data-directory
/mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/../data-directory
GNU gdb (GDB) 10.0.50.20200110-git
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) set height 0
(gdb) set width 0
(gdb) core-file
/mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/outputs/gdb.base/corefile/corefile.core
[New LWP 15497]
Core was generated by
`/mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/outputs/gdb.base/corefil'.
Program terminated with signal SIGABRT, Aborted.
#0  0xf7f7cb29 in __kernel_vsyscall ()
(gdb) PASS: gdb.base/corefile.exp: attach: load core again
info files
Local core dump file:
       
`/mesquite2/sourceware-git/f29-bisect/bld/gdb/testsuite/outputs/gdb.base/corefile/corefile.core',
file type elf32-i386.
        0x08048000 - 0x08049000 is load1
        0x08049000 - 0x08049000 is load2
        0x0804a000 - 0x0804a000 is load3
        0x0804b000 - 0x0804c000 is load4
        0x0804c000 - 0x0804d000 is load5
        0x09a31000 - 0x09a53000 is load6
        0xf7ccc000 - 0xf7ccd000 is load7a
        0xf7ccd000 - 0xf7ccd000 is load7b
        0xf7ce5000 - 0xf7ce5000 is load8
        0xf7e09000 - 0xf7e09000 is load9
        0xf7e6e000 - 0xf7e6e000 is load10
        0xf7e6f000 - 0xf7e71000 is load11
        0xf7e71000 - 0xf7e72000 is load12
        0xf7e72000 - 0xf7e75000 is load13
        0xf7e75000 - 0xf7e76000 is load14a
        0xf7e76000 - 0xf7e76000 is load14b
        0xf7e7f000 - 0xf7e7f000 is load15
        0xf7f0e000 - 0xf7f0e000 is load16
        0xf7f46000 - 0xf7f47000 is load17
        0xf7f47000 - 0xf7f48000 is load18
        0xf7f75000 - 0xf7f77000 is load19
        0xf7f77000 - 0xf7f79000 is load20
        0xf7f79000 - 0xf7f7c000 is load21
        0xf7f7c000 - 0xf7f7d000 is load22
        0xf7f7d000 - 0xf7f7e000 is load23
        0xf7f7e000 - 0xf7f7e000 is load24
        0xf7f9b000 - 0xf7f9b000 is load25
        0xf7fa6000 - 0xf7fa7000 is load26
        0xf7fa7000 - 0xf7fa8000 is load27
        0xff9d1000 - 0xff9f3000 is load28
(gdb) PASS: gdb.base/corefile.exp: attach: sanity check we see the core file
attach 15741
/ironwood1/sourceware-git/f29-bisect/bld/../../worktree-bisect/gdb/dwarf2-frame.c:1009:
internal-error: dwarf2_frame_cache* dwarf2_frame_cache(frame_info*, void**):
Assertion `fde != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.base/corefile.exp: attach: with
core (GDB internal error)
Resyncing due to internal error.

Partial backtrace against HEAD:

#0  internal_error (
    file=0xb71d48
"/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/dwarf2/frame.c",
line=1013, 
    fmt=0xb719df "%s: Assertion `%s' failed.")
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdbsupport/errors.cc:51
#1  0x00000000005a353d in dwarf2_frame_cache (this_frame=0x112a980,
this_cache=0x112a998)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/dwarf2/frame.c:1013
#2  0x00000000005a3e1c in dwarf2_frame_this_id (this_frame=0x112a980,
this_cache=0x112a998, this_id=0x112a9e0)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/dwarf2/frame.c:1226
#3  0x000000000066ba43 in compute_frame_id (fi=0x112a980)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/frame.c:561
#4  0x000000000066bb90 in get_frame_id (fi=0x112a980)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/frame.c:593
#5  0x0000000000944589 in
scoped_restore_current_thread::scoped_restore_current_thread (During symbol
reading: Child DIE 0x433e63 and its abstract origin 0x44ca00 have different
parents
this=0x7fffffffc8e8)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/thread.c:1458
#6  0x00000000004b4f19 in
scoped_restore_current_pspace_and_thread::scoped_restore_current_pspace_and_thread
(During symbol reading: .debug_line address at offset 0x17268e is 0 [in module
/mesquite2/sourceware-git/f32-amd64-corefile/bld-m32/gdb/gdb]
this=0x7fffffffc8e0)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/progspace-and-thread.h:29
#7  0x00000000006554d3 in remove_target_sections (owner=0x12edf30)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/exec.c:798
#8  0x00000000008e45a2 in symfile_free_objfile (objfile=0x12edf30)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/symfile.c:3742
#9  0x00000000004458a4 in std::__invoke_impl<void, void (*&)(objfile*),
objfile*> (
    __f=@0x114dca0: 0x8e4583 <symfile_free_objfile(objfile*)>) at
/usr/include/c++/10/bits/invoke.h:60
#10 0x00000000004443a9 in std::__invoke_r<void, void (*&)(objfile*), objfile*>
(
    __fn=@0x114dca0: 0x8e4583 <symfile_free_objfile(objfile*)>) at
/usr/include/c++/10/bits/invoke.h:153
#11 0x0000000000442fec in std::_Function_handler<void (objfile*), void
(*)(objfile*)>::_M_invoke(std::_Any_data const&, objfile*&&) (__functor=...,
__args#0=@0x7fffffffca60: 0x12edf30) at
/usr/include/c++/10/bits/std_function.h:291
#12 0x00000000007c6167 in std::function<void (objfile*)>::operator()(objfile*)
const (this=0x114dca0, __args#0=0x12edf30)
    at /usr/include/c++/10/bits/std_function.h:622
#13 0x00000000007c5c58 in gdb::observers::observable<objfile*>::notify
(this=0xfd2dc0 <gdb::observers::free_objfile>, 
    args#0=0x12edf30)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/../gdbsupport/observable.h:106
#14 0x00000000007c275d in objfile::~objfile (this=0x12edf30,
__in_chrg=<optimized out>)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/objfiles.c:521
#15 0x00000000007c7774 in std::_Sp_counted_ptr<objfile*,
(__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x12ee190)
    at /usr/include/c++/10/bits/shared_ptr_base.h:380
#16 0x00000000004b97c9 in
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x12ee190)
    at /usr/include/c++/10/bits/shared_ptr_base.h:158
#17 0x00000000004b57ab in
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count
(this=0x1220308, 
    __in_chrg=<optimized out>) at
/usr/include/c++/10/bits/shared_ptr_base.h:733
#18 0x00000000007c5668 in std::__shared_ptr<objfile,
(__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x1220300, 
    __in_chrg=<optimized out>) at
/usr/include/c++/10/bits/shared_ptr_base.h:1183
#19 0x00000000007c5684 in std::shared_ptr<objfile>::~shared_ptr
(this=0x1220300, __in_chrg=<optimized out>)
    at /usr/include/c++/10/bits/shared_ptr.h:121
#20 0x00000000007f43f0 in
__gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> >
>::destroy<std::shared_ptr<objfile> > (this=0x1199e40, __p=0x1220300) at
/usr/include/c++/10/ext/new_allocator.h:156
#21 0x00000000007f3df1 in
std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> >
> >::destroy<std::shared_ptr<objfile> > (__a=..., __p=0x1220300) at
/usr/include/c++/10/bits/alloc_traits.h:531
#22 0x00000000007f3a6e in std::__cxx11::list<std::shared_ptr<objfile>,
std::allocator<std::shared_ptr<objfile> > >::_M_erase (
    this=0x1199e40, __position=std::shared_ptr<objfile> (expired, weak count 1)
= {get() = 0x12edf30})
    at /usr/include/c++/10/bits/stl_list.h:1925
#23 0x00000000007f3462 in std::__cxx11::list<std::shared_ptr<objfile>,
std::allocator<std::shared_ptr<objfile> > >::erase (
    this=0x1199e40, __position=std::shared_ptr<objfile> (expired, weak count 1)
= {get() = 0x12edf30})
    at /usr/include/c++/10/bits/list.tcc:158
#24 0x00000000007f1e49 in program_space::remove_objfile (this=0x1199e00,
objfile=0x12edf30)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/progspace.c:207
#25 0x00000000007c26e8 in objfile::unlink (this=0x12edf30)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/objfiles.c:497
#26 0x00000000007c39fa in objfile_purge_solibs ()
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/objfiles.c:904
#27 0x00000000008b462f in no_shared_libraries (ignored=0x0, from_tty=1)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/solib.c:1236
#28 0x0000000000927a07 in target_pre_inferior (from_tty=1)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/target.c:1900
#29 0x00000000006ee394 in attach_command (args=0x12a9227 "140459", from_tty=1)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/infcmd.c:2582

I wondered about why x86_64 works, but -m32 does not.  I ran them side-by-side
and found...

x86_64:

Thread 1 "gdb" hit Breakpoint 4, remove_target_sections (During symbol reading:
incomplete CFI data; unspecified registers (e.g., rax) at 0x653ccc
owner=0x12da6e0)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/exec.c:798
798               scoped_restore_current_pspace_and_thread
restore_pspace_thread;
(top-gdb) c
Continuing.

Thread 1 "gdb" hit Breakpoint 6,
scoped_restore_current_thread::scoped_restore_current_thread
(this=0x7fffffffc8f8)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/thread.c:1458
1458              m_selected_frame_id = get_frame_id (frame);
(top-gdb) s
get_frame_id (fi=0x1130bf0) at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/frame.c:578
578       if (fi == NULL)
(top-gdb) 
581       if (!fi->this_id.p)
(top-gdb) 
590           gdb_assert (fi->level == 0);
(top-gdb) n
593           compute_frame_id (fi);
(top-gdb) s
compute_frame_id (fi=0x1130bf0) at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/frame.c:550
550       gdb_assert (!fi->this_id.p);
(top-gdb) n
552       if (frame_debug)
(top-gdb) n
556       if (fi->unwind == NULL)
(top-gdb) 
560       fi->this_id.value = outer_frame_id;
(top-gdb) 
561       fi->unwind->this_id (fi, &fi->prologue_cache, &fi->this_id.value);
(top-gdb) s
amd64_frame_this_id (this_frame=0x1130bf0, this_cache=0x1130c08,
this_id=0x1130c50)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/amd64-tdep.c:2686
2686        amd64_frame_cache (this_frame, this_cache);
(top-gdb) up
#1  0x000000000066a143 in compute_frame_id (fi=0x1130bf0) at
/ironwood1/sourceware-git/f32-amd64-corefile/bld/../../worktree-corefile/gdb/frame.c:561
561       fi->unwind->this_id (fi, &fi->prologue_cache, &fi->this_id.value);
(top-gdb) p fi->unwind->this_id
$10 = (frame_this_id_ftype *) 0x45ea70 <amd64_frame_this_id(frame_info*,
void**, frame_id*)>
(top-gdb) 


-m32:

Thread 1 "gdb" hit Breakpoint 4, remove_target_sections (During symbol reading:
incomplete CFI data; unspecified registers (e.g., rax) at 0x6555cc
owner=0x12cc960)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/exec.c:798
798               scoped_restore_current_pspace_and_thread
restore_pspace_thread;
(top-gdb) b thread.c:1458
Breakpoint 6 at 0x944572: file
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/thread.c,
line 1458.
(top-gdb) del 5
(top-gdb) c
Continuing.

Thread 1 "gdb" hit Breakpoint 6,
scoped_restore_current_thread::scoped_restore_current_thread
(this=0x7fffffffc8e8)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/thread.c:1458
1458              m_selected_frame_id = get_frame_id (frame);
(top-gdb) s
get_frame_id (fi=0x112a980) at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/frame.c:578
578       if (fi == NULL)
(top-gdb) s
581       if (!fi->this_id.p)
(top-gdb) 
590           gdb_assert (fi->level == 0);
(top-gdb) n
593           compute_frame_id (fi);
(top-gdb) s
compute_frame_id (fi=0x112a980) at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/frame.c:550
550       gdb_assert (!fi->this_id.p);
(top-gdb) n
552       if (frame_debug)
(top-gdb) 
556       if (fi->unwind == NULL)
(top-gdb) 
560       fi->this_id.value = outer_frame_id;
(top-gdb) 
561       fi->unwind->this_id (fi, &fi->prologue_cache, &fi->this_id.value);
(top-gdb) s
dwarf2_frame_this_id (this_frame=0x112a980, this_cache=0x112a998,
this_id=0x112a9e0)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/dwarf2/frame.c:1226
1226        dwarf2_frame_cache (this_frame, this_cache);
(top-gdb) up
#1  0x000000000066ba43 in compute_frame_id (fi=0x112a980)
    at
/ironwood1/sourceware-git/f32-amd64-corefile/bld-m32/../../worktree-corefile/gdb/frame.c:561
561       fi->unwind->this_id (fi, &fi->prologue_cache, &fi->this_id.value);
(top-gdb) p fi->unwind->this_id
$7 = (frame_this_id_ftype *) 0x5a3df4 <dwarf2_frame_this_id(frame_info*,
void**, frame_id*)>

I.e. x86_64 is using the amd64 unwinder, but -m32 is using the dwarf2 unwinder.

(But I'm thinking that for this particular scenario, just getting to this point
where we're mucking about with unwinders at all might be the problem.)

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

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

end of thread, other threads:[~2020-08-12 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  3:20 [Bug gdb/26336] New: corefile.exp regression for unix/-m32 on x86_64 kevinb at redhat dot com
2020-08-04  3:21 ` [Bug gdb/26336] " kevinb at redhat dot com
2020-08-06 16:05 ` palves at redhat dot com
2020-08-12 18:45 ` cvs-commit at gcc dot gnu.org
2020-08-12 19:01 ` palves at redhat dot com

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