public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ssbssa at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/23555] Segmentation fault on attempt to print warning that getcwd failed
Date: Thu, 04 Jan 2024 22:13:19 +0000	[thread overview]
Message-ID: <bug-23555-4717-D4C79YWJ8z@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23555-4717@http.sourceware.org/bugzilla/>

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

Hannes Domani <ssbssa at sourceware dot org> changed:

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

--- Comment #7 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Sourceware Commits from comment #5)
> The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
> 
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> h=20f0d60db4fb5083779c4c9182bbc692f7d2bac5
> 
> commit 20f0d60db4fb5083779c4c9182bbc692f7d2bac5
> Author: Tom Tromey <tom@tromey.com>
> Date:   Fri Oct 5 14:54:35 2018 -0600
> 
>     Avoid crash when calling warning too early
>     
>     I noticed that if you pass the name of an existing file (not a
>     directory) as the argument to --data-directory, gdb will crash:
>     
>         $ ./gdb -nx  --data-directory  ./gdb
>         ../../binutils-gdb/gdb/target.c:590:56: runtime error: member call
> on null pointer of type 'struct target_ops'
>     
>     This was later reported as PR gdb/23838.
>     
>     This happens because warning ends up calling
>     target_supports_terminal_ours, which calls current_top_target, which
>     returns nullptr this early.
>     
>     This fixes the problem by handling this case specially in
>     target_supports_terminal_ours.  I also changed
>     target_supports_terminal_ours to return bool.
>     
>     gdb/ChangeLog
>     2018-11-08  Tom Tromey  <tom@tromey.com>
>     
>     	PR gdb/23555:
>     	PR gdb/23838:
>     	* target.h (target_supports_terminal_ours): Return bool.
>     	* target.c (target_supports_terminal_ours): Handle case where
>     	current_top_target returns nullptr.  Return bool.
>     
>     gdb/testsuite/ChangeLog
>     2018-11-08  Tom Tromey  <tom@tromey.com>
>     
>     	PR gdb/23555:
>     	PR gdb/23838:
>     	* gdb.base/warning.exp: New file.

Can this be closed?

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

           reply	other threads:[~2024-01-04 22:13 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <bug-23555-4717@http.sourceware.org/bugzilla/>]

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=bug-23555-4717-D4C79YWJ8z@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).