This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Avoid crash when calling warning too early
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Thu, 08 Nov 2018 18:39:47 -0500
- Subject: [binutils-gdb] Avoid crash when calling warning too early
*** TEST RESULTS FOR COMMIT 20f0d60db4fb5083779c4c9182bbc692f7d2bac5 ***
Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 20f0d60db4fb5083779c4c9182bbc692f7d2bac5
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.
- Follow-Ups:
- Failures on Fedora-i686, branch master
- Failures on Fedora-x86_64-cc-with-index, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-m64, branch master
- Failures on Fedora-s390x-m64, branch master
- Failures on Fedora-x86_64-native-gdbserver-m64, branch master
- Failures on Fedora-x86_64-m32, branch master
- Failures on Fedora-x86_64-native-gdbserver-m32, branch master
- Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master
- Failures on Debian-s390x-m64, branch master
- Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master
- Failures on Ubuntu-Aarch64-m64, branch master