public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
@ 2023-07-17  8:22 vries at gcc dot gnu.org
  2023-07-17  8:23 ` [Bug dap/30644] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-17  8:22 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30644
           Summary: [gdb/dap] ERROR: tcl error sourcing
                    gdb.dap/stop-at-main.exp
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dap
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Created attachment 14974
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14974&action=edit
gdb.log

As noted here (
https://sourceware.org/pipermail/gdb-patches/2023-July/200945.html ), commit
75ec0982978 ("Use correct inferior in Inferior.read_memory et al") breaks
test-case gdb.dap/stop-at-main.exp:
...
{"request_seq": 2, "type": "response", "command": "launch", "success": true,
"seq": 3}PASS: gdb.dap/stop-at-main.exp: startup - launch success
>>> {"seq": 3, "type": "request", "command": "configurationDone"}
Content-Length: 97^M
^M
{"request_seq": 3, "type": "response", "command": "configurationDone",
"success": true, "seq": 4}PASS: gdb.dap/stop-at-main.exp: start inferior
success
ERROR: eof reading json header
    while executing
"error "eof reading json header""
    invoked from within
"expect {
-i exp19 -timeout 10
        -re "^Content-Length: (\[0-9\]+)\r\n" {
            set length $expect_out(1,string)
            exp_continue
        }
        -re "^(\[^\r\n\]+)..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" NONE eof reading json header
ERROR: tcl error sourcing
/data/vries/gdb/src/gdb/testsuite/gdb.dap/stop-at-main.exp.
...

Unfortunately, the failure comes in the form of an ERROR.

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
@ 2023-07-17  8:23 ` vries at gcc dot gnu.org
  2023-07-17  8:24 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-17  8:23 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14975
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14975&action=edit
dap.log.1

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
  2023-07-17  8:23 ` [Bug dap/30644] " vries at gcc dot gnu.org
@ 2023-07-17  8:24 ` vries at gcc dot gnu.org
  2023-07-17  8:25 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-17  8:24 UTC (permalink / raw)
  To: gdb-prs

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

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

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

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
  2023-07-17  8:23 ` [Bug dap/30644] " vries at gcc dot gnu.org
  2023-07-17  8:24 ` vries at gcc dot gnu.org
@ 2023-07-17  8:25 ` vries at gcc dot gnu.org
  2023-07-17 13:21 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-17  8:25 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aburgess at redhat dot com

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-07-17  8:25 ` vries at gcc dot gnu.org
@ 2023-07-17 13:21 ` tromey at sourceware dot org
  2023-07-17 17:38 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-07-17 13:21 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Mine.

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-07-17 13:21 ` tromey at sourceware dot org
@ 2023-07-17 17:38 ` tromey at sourceware dot org
  2023-07-19 13:12 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-07-17 17:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-July/200958.html

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-07-17 17:38 ` tromey at sourceware dot org
@ 2023-07-19 13:12 ` cvs-commit at gcc dot gnu.org
  2023-07-19 13:43 ` pedro at palves dot net
  2023-07-19 14:10 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-19 13:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

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

commit 6d30ada87b7a515a0f623687e2faadc1d4acf440
Author: Pedro Alves <pedro@palves.net>
Date:   Mon Jul 17 18:31:02 2023 +0100

    Fix gdb.Inferior.read_memory without execution (PR dap/30644)

    Andrew reported that the previous change to gdb.Inferior.read_memory &
    friends introducing scoped_restore_current_inferior_for_memory broke
    gdb.dap/stop-at-main.exp.  This is also reported as PR dap/30644.

    The root of the problem is that all the methods that now use
    scoped_restore_current_inferior_for_memory cause GDB to crash with a
    failed assert if they are run on an inferior that is not yet started.

    E.g.:

     (gdb) python i = gdb.selected_inferior ()
     (gdb) python i.read_memory (4,4)
     gdb/thread.c:626: internal-error: any_thread_of_inferior: Assertion
`inf->pid != 0' failed.

    This patch fixes the problem by removing
    scoped_restore_current_inferior_for_memory's ctor ptid parameter and
    the any_thread_of_inferior calls completely, and making
    scoped_restore_current_inferior_for_memory switch inferior_ptid to a
    pid ptid.

    I was a little worried that some port might be assuming inferior_ptid
    points at a thread in the xfer_partial memory access routines.  We
    know that anything that supports forks must not assume that, due to
    how detach_breakpoints works.  I looked at a number of xfer_partial
    implementations, and didn't see anything that is looking at
    inferior_ptid in a way that would misbehave.  I'm thinking that we
    could go forward with this and just fix ports if they break.

    While on some ports like on AMD GPU we have thread-specific address
    spaces, and so when accessing memory for those address spaces, we must
    have the right thread context (via inferior_ptid) selected, in
    Inferior.read_memory, we only have the inferior to work with, so this
    API as is can't be used to access thread-specific address spaces.
    IOW, it can only be used to access the global address space that is
    visible to both the CPU and the GPUs.

    In proc-service.c:ps_xfer_memory, the other spot using
    scoped_restore_current_inferior_for_memory, we're always accessing
    per-inferior memory.

    If we end up using scoped_restore_current_inferior_for_memory later to
    set up the context to read memory from a specific thread, then we can
    add an alternative ctor that takes a thread_info pointer, and make
    inferior_ptid point to the thread, for example.

    New test added to gdb.python/py-inferior.exp, exercising
    Inferior.read_memory without execution.

    No regressions on native and extended-gdbserver x86_64 GNU/Linux.

    Reviewed-By: Tom Tromey <tom@tromey.com>
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30644
    Change-Id: I11309c5ddbbb51a4594cf63c21b3858bfd9aed19

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-07-19 13:12 ` cvs-commit at gcc dot gnu.org
@ 2023-07-19 13:43 ` pedro at palves dot net
  2023-07-19 14:10 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pedro at palves dot net @ 2023-07-19 13:43 UTC (permalink / raw)
  To: gdb-prs

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

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |pedro at palves dot net

--- Comment #5 from Pedro Alves <pedro at palves dot net> ---
Fixed.

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

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

* [Bug dap/30644] [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp
  2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-07-19 13:43 ` pedro at palves dot net
@ 2023-07-19 14:10 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-19 14:10 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1

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

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

end of thread, other threads:[~2023-07-19 14:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17  8:22 [Bug dap/30644] New: [gdb/dap] ERROR: tcl error sourcing gdb.dap/stop-at-main.exp vries at gcc dot gnu.org
2023-07-17  8:23 ` [Bug dap/30644] " vries at gcc dot gnu.org
2023-07-17  8:24 ` vries at gcc dot gnu.org
2023-07-17  8:25 ` vries at gcc dot gnu.org
2023-07-17 13:21 ` tromey at sourceware dot org
2023-07-17 17:38 ` tromey at sourceware dot org
2023-07-19 13:12 ` cvs-commit at gcc dot gnu.org
2023-07-19 13:43 ` pedro at palves dot net
2023-07-19 14:10 ` 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).