From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#58826: 29.0.50; gud-gdb can't find core file if executable is in a different directory Date: Sat, 12 Nov 2022 20:32:34 -0800 Message-ID: References: <87wn8komdb.fsf@jpl.nasa.gov> <83zgdgjwk3.fsf@gnu.org> <87y1t0mp40.fsf@secretsauce.net> <83pmecjtxh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10264"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dima Kogan , 58826@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 13 05:33:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ou4gI-0002Y0-KA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Nov 2022 05:33:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ou4g5-0002LQ-Fv; Sat, 12 Nov 2022 23:33:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ou4g2-0002KD-Uz for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 23:33:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ou4g2-0007s9-HX for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 23:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ou4g2-0002ZA-7q for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 23:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2022 04:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58826 X-GNU-PR-Package: emacs Original-Received: via spool by 58826-submit@debbugs.gnu.org id=B58826.16683139639838 (code B ref 58826); Sun, 13 Nov 2022 04:33:02 +0000 Original-Received: (at 58826) by debbugs.gnu.org; 13 Nov 2022 04:32:43 +0000 Original-Received: from localhost ([127.0.0.1]:49787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ou4fj-0002Yc-8G for submit@debbugs.gnu.org; Sat, 12 Nov 2022 23:32:43 -0500 Original-Received: from mail-ot1-f43.google.com ([209.85.210.43]:46007) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ou4fh-0002YM-8E for 58826@debbugs.gnu.org; Sat, 12 Nov 2022 23:32:42 -0500 Original-Received: by mail-ot1-f43.google.com with SMTP id 94-20020a9d0067000000b0066c8d13a33dso4939454ota.12 for <58826@debbugs.gnu.org>; Sat, 12 Nov 2022 20:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=9cBvzUTwWzgKPTG1BcyQzB26ncMprqt/tsC+XzvEKs0=; b=kE3LnQSzUU39nHgCUPAPuL85NqUXgAq1dIogh8YHtGM6rXPoIlN7Pz2k4Y0h1BBMvW nnmQE9WbKTvsB4D5F/I8qSoVc55YCAISeL3F1Gk8fBlEmJhzmEpIA0j4XgmqpDekmNKr dGilSAN0NOzA27inrEcs+SnIT2CUjuaAke4KvPs5v/Sn+VHDdSr+a1LxrjnwEZiFwSXv o4K2u2IrOap5KGtuxf6aJ6lLqAZ5c3ANZFBfCd4AoNPEC8hT5YSdn4ijxstq/6WCe4rb ZX1SDUWDItg9rLx4XZmSmZEQ+qxV84axlQBNxODZMZsJjlkylacPmUkn+aTmEfNWnsVl VB3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9cBvzUTwWzgKPTG1BcyQzB26ncMprqt/tsC+XzvEKs0=; b=xenvVOepNwbtmbRLa6sOooxiOl8GFgpwKhhO29Mq9l23kvZm+//9QD4bwwedOQVedv o8X9loj2zO5sK0JodrQLXTozk/8tIRVJSyD1ioVsG4V0LFNCQD7Gqts78VO89VAg+D3n 3WW1zC7PE2aizHeptTsD6lMfISsc72EI8AD2k+SGVfxCzPnEYYNkp9lGcXxCR5Qzg498 vnXi9o4f7stlZ2NpOv4pHDOqbrSHwIPq1585AsvVBz3ULf4Dswas/0ZRhpmGKQxu3+Pu zujooxiQIQz2QhnXHOmg0bhcUXNO3FqX3VgKq0qLhCZcV9D1XpyvUZRI5ZOTfu/MXC6l 45uw== X-Gm-Message-State: ANoB5pmkGvCSp45BWR3WpOqCyUMHrtCO9gdYgWzbeZvapKkDWDzOUmqx moaG0vEkM+9eKMTZKwcBHOd35ONZRsVtPiuscWI= X-Google-Smtp-Source: AA0mqf6zf2n/QQtoIoi51npqJmORiCd6wkDppb/E0UpUwk75Py62IrUhUYVrhRNNpQXaQXEv//R1Ei0Bmn0/UdgAm+o= X-Received: by 2002:a9d:6399:0:b0:661:c48b:12db with SMTP id w25-20020a9d6399000000b00661c48b12dbmr4167619otk.105.1668313955525; Sat, 12 Nov 2022 20:32:35 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 12 Nov 2022 20:32:34 -0800 In-Reply-To: <83pmecjtxh.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 28 Oct 2022 10:20:26 +0300") X-Hashcash: 1:20:221113:eliz@gnu.org::7JorK58nuenv0ALf:3QUY X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247738 Archived-At: Eli Zaretskii writes: >> > AFAIU, if you run the debugger like this: >> > >> > gdb --fullname python3 core.sfmviz.py.1807941 >> > >> > then GUD will not change the default-directory to /usr/bin, which I >> > believe is what you want. GDB will then locate the Python executable >> > either in the current default-directory or by searching PATH. >> >> OK. It's documented, but it's still not good. What if the executable >> wasn't in the $PATH? > > Is that what happens in your case? > > In general, you need in that case to change to the directory of the > executable, and invoke gud-gdb from there. > > IME, the current behavior covers most of the use cases: either you are > debugging a program you are developing from its source tree, or you > are debugging an installed program that's on PATH. > >> It's also really unintuitive to have an implicit change of directory >> here, and it would match most people's expectations if it was changed, I >> think. Do you know why we're doing that? > > If you think about that, it's actually quite natural: it makes the > files you are likely to access from the debug session appear in the > current directory. I think Eli is right here. > In any case, this is a long-standing behavior. Indeed. So any change would also need to be careful not to break backwards-compatibility in relevant cases. At the same time, users might not expect the change of directory to depend on whether or not she says "python3" or "/usr/bin/python3". So to avoid just wontfixing this outright, here are some alternative ideas: - Perhaps we could skip changing the directory if the prefix (in the above case "/usr/bin") is already in PATH? - But that won't take care of the case where it is *not* in PATH. So perhaps we should have even more heuristics to also see if it is some interpreter (under the assumption that interpreters generally don't live together with the source code that is being debugged)? IOW, if --fullname is some well-known value like "python3", we don't change directory by default. We would need to consider if such a change would break anything for relevant use-cases, of course. That's the best I could think of, at least. If that is overcomplicating things, I guess we will have to close this bug as wontfix, as unsatisfying as that seems.