public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint
@ 2020-10-14  7:45 vries at gcc dot gnu.org
  2020-10-14  7:49 ` [Bug gdb/26733] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14  7:45 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26733
           Summary: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp:
                    continue to exec catchpoint
           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: ---

With current trunk (commit 7b47a31256) I see:
...
(gdb) PASS: gdb.base/exec-invalid-sysroot.exp: insert exec catchpoint
continue^M
Continuing.^M
foll-exec is about to execlp(execd-prog)...^M
process 22252 is executing new program:
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/exec-invalid-sysroot/execd-prog^M
warning: Could not load symbols for executable
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/exec-invalid-sysroot/execd-prog.^M
Do you need "set sysroot"?^M
ERROR: GDB process no longer exists
GDB process exited with wait status 22239 exp12 0 0 CHILDKILLED SIGABRT SIGABRT
...

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

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

* [Bug gdb/26733] UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
@ 2020-10-14  7:49 ` vries at gcc dot gnu.org
  2020-10-14  9:05 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14  7:49 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This and similar in gdb.base/print-symbol-loading.exp look related:
...
(gdb) PASS: gdb.base/print-symbol-loading.exp: core off: file
Executing on host: mv -f
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so.save
   (timeout = 300)
spawn -ignore SIGHUP mv -f
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so.save
core
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading.gcore
warning: Can't open file
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so
during file-backed mapping note processing
[New LWP 12006]
warning: Could not load shared library symbols for
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol-loading/print-symbol-loading-lib.so.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by
`/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/print-symbol'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
ERROR: GDB process no longer exists
GDB process exited with wait status 12015 exp19 0 0 CHILDKILLED SIGABRT SIGABRT
UNRESOLVED: gdb.base/print-symbol-loading.exp: core off: re-load generated
corefile
...

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

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

* [Bug gdb/26733] UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
  2020-10-14  7:49 ` [Bug gdb/26733] " vries at gcc dot gnu.org
@ 2020-10-14  9:05 ` vries at gcc dot gnu.org
  2020-10-14  9:20 ` [Bug gdb/26733] segfault in solib_contains_address_p vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14  9:05 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
bb2a67773c5e06545c39a6373be720c7d3d9eeb5 is the first bad commit
commit bb2a67773c5e06545c39a6373be720c7d3d9eeb5
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Oct 12 15:53:16 2020 -0600

    Use a std::vector in target_section_table

    This changes target_section_table to wrap a std::vector.  This
    simplifies some code, and also enables the simplifications coming in
    the subsequent patches.

    Note that for solib, I chose to have it use a pointer to a
    target_section_table.  This is more convoluted than would be ideal,
    but I didn't want to convert solib to new/delete as a prerequisite for
    this series.

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

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

* [Bug gdb/26733] segfault in solib_contains_address_p
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
  2020-10-14  7:49 ` [Bug gdb/26733] " vries at gcc dot gnu.org
  2020-10-14  9:05 ` vries at gcc dot gnu.org
@ 2020-10-14  9:20 ` vries at gcc dot gnu.org
  2020-10-14  9:37 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14  9:20 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|UNRESOLVED:                 |segfault in
                   |gdb.base/exec-invalid-sysro |solib_contains_address_p
                   |ot.exp: continue to exec    |
                   |catchpoint                  |

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduce:
...
gdb \
  -batch \
  outputs/gdb.base/exec-invalid-sysroot/foll-exec \
  -ex "set sysroot /a/path/that/does/not/exist" \
  -ex "break main" \
  -ex run \
  -ex "catch exec" \
  -ex continue
...

Actual problem:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
solib_contains_address_p (address=4196111, solib=0x1dd9970)
    at /home/vries/gdb_versions/devel/src/gdb/solib.c:1120
1120      for (target_section &p : solib->sections->sections)
(gdb) p solib->sections->sections
Cannot access memory at address 0x0
...

Backtrace at segfault:
...
(gdb) bt
#0  solib_contains_address_p (address=4196111, solib=0x1dd9970)
    at /home/vries/gdb_versions/devel/src/gdb/solib.c:1120
#1  solib_name_from_address (pspace=0x1a465a0, address=4196111)
    at /home/vries/gdb_versions/devel/src/gdb/solib.c:1144
#2  0x000000000049c8ec in disable_breakpoints_in_shlibs ()
    at /home/vries/gdb_versions/devel/src/gdb/breakpoint.c:7489
#3  0x0000000000767e06 in clear_solib ()
    at /home/vries/gdb_versions/devel/src/gdb/solib.c:1170
#4  0x0000000000767ee9 in no_shared_libraries (ignored=ignored@entry=0x0, 
    from_tty=from_tty@entry=0) at
/home/vries/gdb_versions/devel/src/gdb/solib.c:1230
#5  0x000000000060280b in follow_exec (exec_file_target=<optimized out>,
ptid=...)
    at /home/vries/gdb_versions/devel/src/gdb/infrun.c:1185
#6  handle_inferior_event (ecs=ecs@entry=0x7fffffffd660)
    at /home/vries/gdb_versions/devel/src/gdb/infrun.c:5493
#7  0x00000000006031c2 in fetch_inferior_event ()
    at /home/vries/gdb_versions/devel/src/gdb/infrun.c:3927
#8  0x00000000009bbcfd in gdb_wait_for_event (block=block@entry=0)
    at /home/vries/gdb_versions/devel/src/gdbsupport/event-loop.cc:701
#9  0x00000000009bbec7 in gdb_do_one_event ()
    at /home/vries/gdb_versions/devel/src/gdbsupport/event-loop.cc:212
#10 0x00000000007c2dac in wait_sync_command_done ()
    at /home/vries/gdb_versions/devel/src/gdb/top.c:526
#11 0x00000000007c342d in maybe_wait_sync_command_done (was_sync=0)
    at /home/vries/gdb_versions/devel/src/gdb/top.c:543
#12 execute_command (p=<optimized out>, 
    p@entry=<error reading variable: value has been optimized out>, from_tty=0, 
    from_tty@entry=<error reading variable: value has been optimized out>)
    at /home/vries/gdb_versions/devel/src/gdb/top.c:670
#13 0x000000000063e14e in catch_command_errors (command=<optimized out>, 
    arg=<optimized out>, from_tty=<optimized out>)
    at /home/vries/gdb_versions/devel/src/gdb/main.c:457
#14 0x000000000063fdd7 in captured_main_1
(context=context@entry=0x7fffffffda70)
    at /home/vries/gdb_versions/devel/src/gdb/main.c:1218
#15 0x000000000064038b in captured_main (data=data@entry=0x7fffffffda70)
    at /home/vries/gdb_versions/devel/src/gdb/main.c:1243
#16 gdb_main (args=args@entry=0x7fffffffda90)
    at /home/vries/gdb_versions/devel/src/gdb/main.c:1268
#17 0x000000000041b745 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/vries/gdb_versions/devel/src/gdb/gdb.c:32
(gdb) 
...

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

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

* [Bug gdb/26733] segfault in solib_contains_address_p
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-10-14  9:20 ` [Bug gdb/26733] segfault in solib_contains_address_p vries at gcc dot gnu.org
@ 2020-10-14  9:37 ` vries at gcc dot gnu.org
  2020-10-14 10:24 ` cvs-commit at gcc dot gnu.org
  2020-10-14 10:26 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14  9:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/solib.c b/gdb/solib.c
index b4864429e9..28f6a4ecbf 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1113,6 +1113,9 @@ bool
 solib_contains_address_p (const struct so_list *const solib,
                          CORE_ADDR address)
 {
+  if (solib->sections == nullptr)
+    return false;
+
   for (target_section &p : *solib->sections)
     if (p.addr <= address && address < p.endaddr)
       return true;
...

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

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

* [Bug gdb/26733] segfault in solib_contains_address_p
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-10-14  9:37 ` vries at gcc dot gnu.org
@ 2020-10-14 10:24 ` cvs-commit at gcc dot gnu.org
  2020-10-14 10:26 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-14 10:24 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 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=76547ab31b16b521e29892cab5a29b60b52291a5

commit 76547ab31b16b521e29892cab5a29b60b52291a5
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Oct 14 12:24:42 2020 +0200

    [gdb] Fix segfault in solib_contains_address_p

    Starting commit bb2a67773c "Use a std::vector in target_section_table" we
run
    into:
    ...
    ERROR: GDB process no longer exists
    GDB process exited with wait status 22239 exp12 0 0 CHILDKILLED SIGABRT
    UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint
    ...
    which reproduces as:
    ...
    Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
    solib_contains_address_p (address=4196111, solib=0x1dd9970)
        at /home/vries/gdb_versions/devel/src/gdb/solib.c:1120
    1120      for (target_section &p : solib->sections->sections)
    (gdb) p solib->sections->sections
    Cannot access memory at address 0x0
    ...

    Fix this by handling solib->sections == nullptr in
solib_contains_address_p.

    Build and reg-tested on x86_64-linux.

    gdb/ChangeLog:

    2020-10-14  Tom de Vries  <tdevries@suse.de>

            PR gdb/26733
            * solib.c (solib_contains_address_p): Handle
            'solib->sections == nullptr'.

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

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

* [Bug gdb/26733] segfault in solib_contains_address_p
  2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-10-14 10:24 ` cvs-commit at gcc dot gnu.org
@ 2020-10-14 10:26 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-14 10:26 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #6 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] 7+ messages in thread

end of thread, other threads:[~2020-10-14 10:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  7:45 [Bug gdb/26733] New: UNRESOLVED: gdb.base/exec-invalid-sysroot.exp: continue to exec catchpoint vries at gcc dot gnu.org
2020-10-14  7:49 ` [Bug gdb/26733] " vries at gcc dot gnu.org
2020-10-14  9:05 ` vries at gcc dot gnu.org
2020-10-14  9:20 ` [Bug gdb/26733] segfault in solib_contains_address_p vries at gcc dot gnu.org
2020-10-14  9:37 ` vries at gcc dot gnu.org
2020-10-14 10:24 ` cvs-commit at gcc dot gnu.org
2020-10-14 10:26 ` 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).