From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13790 invoked by alias); 19 Nov 2018 18:52:46 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 13777 invoked by uid 89); 19 Nov 2018 18:52:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (158.69.185.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Nov 2018 18:52:45 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb/gdb-8.2-branch] Avoid crash when calling warning too early From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <9ec912f34410c33de581b5af4a0773c12b4fe20a@gdb-build> Date: Mon, 19 Nov 2018 19:08:00 -0000 X-SW-Source: 2018-q4/txt/msg03693.txt.bz2 *** TEST RESULTS FOR COMMIT 9ec912f34410c33de581b5af4a0773c12b4fe20a *** Author: Tom Tromey Branch: gdb-8.2-branch Commit: 9ec912f34410c33de581b5af4a0773c12b4fe20a 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. 2018-11-08 Tom Tromey 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 PR gdb/23555: PR gdb/23838: * gdb.base/warning.exp: New file.