public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org,  Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH] Guard against killing unrelated processes in amd64-disp-step.exp
Date: Thu, 13 Jul 2023 19:59:39 +0200	[thread overview]
Message-ID: <yddy1jjr8tw.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <87cz0vpy7g.fsf@tromey.com> (Tom Tromey's message of "Thu, 13 Jul 2023 10:34:27 -0600")

Hi Tom,

>>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
> Rainer> When testing current gdb trunk on Solaris/amd64, the whole session was
> Rainer> reliably terminated by make check.  I could trace this to the following
> Rainer> entry in gdb.arch/amd64-disp-step/gdb.log:
>
> Thank you for the patch.
>
> Rainer> If $inferior_pid doesn't refer a single process for some reason, this
> Rainer> kill would terminate either a process group or the whole session.
>
> I don't mind the patch, it seems like an improvement -- but I wonder why

That's what I thought: if for whatever reason the pid turns
non-positive, hell breaks lose if that's passed to kill unchecked.

> this ends up as -1, and whether a fix belongs elsewhere.

gdb.log shows

(gdb) PASS: gdb.arch/amd64-disp-step.exp: add into rcx: send_signal=off: verify_regs: rdi expected value
jump test_rip_rcx
Continuing at 0x4015b2.

Program terminated with signal SIGALRM, Alarm clock.
The program no longer exists.
[...]
[Current inferior is 1 [<null>] (/vol/obj/gnu/gdb/gdb/11.4-amd64-dist/gdb/testsuite/outputs/gdb.arch/amd64-disp-step/amd64-disp-step)]

lib/gdb.exp (get_inferior_pid) turns this <null> into -1:

proc get_inferior_pid {} {
    set pid -1
    gdb_test_multiple "inferior" "get inferior pid" {
        -re "process (\[0-9\]*).*$::gdb_prompt $" {
            set pid $expect_out(1,string)
            pass $gdb_test_name
        }
    }
    return $pid
}

This is certainly something that shouldn't happen and fixing the
underlying problem(s) would avoid the kill for sure.  However, the
Solaris gdb port is in a terrible state with about 3200 testsuite
failures on amd64-pc-solaris2.11.  I've made a few attempts to fix the
most glaring issues, but that never got me anywere until I've decided
that the gdb codebase is simply beyond my abilities.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

  reply	other threads:[~2023-07-13 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 11:19 Rainer Orth
2023-07-13 16:34 ` Tom Tromey
2023-07-13 17:59   ` Rainer Orth [this message]
2023-07-14 17:25     ` Pedro Alves
2023-07-19 12:21       ` Rainer Orth
2023-07-15 13:38 ` Andrew Burgess
2023-07-19 12:37   ` Rainer Orth
2023-08-01 14:05     ` Rainer Orth
2023-08-02 20:56       ` Tom Tromey
2023-08-07 13:51         ` Rainer Orth
2023-08-07 22:14           ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yddy1jjr8tw.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).