public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb/gdb-8.1-branch] Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7)
@ 2018-01-05 20:29 sergiodj+buildbot
  2018-01-05 20:29 ` *** COMPILATION FAILED *** Failures on Fedora-i686, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
                   ` (12 more replies)
  0 siblings, 13 replies; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-05 20:29 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 1ec6a1148ad3ca06f48be269e1b61cb9c61a0938 ***

Author: Pedro Alves <palves@redhat.com>
Branch: gdb-8.1-branch
Commit: 1ec6a1148ad3ca06f48be269e1b61cb9c61a0938

Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7)

At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew
reports that the fix for PR gdb/18653 made GDB useless if you preload
libSegFault.so, because GDB internal-errors on startup:

 $ LD_PRELOAD=libSegFault.so gdb
 src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Aborted (core dumped)
 $

The internal error comes from the code saving the signal dispositions
inherited from gdb's parent:

 (top-gdb) bt
 #0  0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54
 #1  0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64
 #2  0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860)
     at src/gdb/main.c:509
 #3  0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145
 During symbol reading, cannot get low and high bounds for subprogram DIE at 24065.
 #4  0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171
 #5  0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32

This commit downgrades the internal error to a warning.  You'll get
instead:

~~~
 $ LD_PRELOAD=libSegFault.so gdb
 warning: Found custom handler for signal 11 (Segmentation fault) preinstalled.
 Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)
 won't be propagated to spawned programs.
 GNU gdb (GDB) 8.0.50.20171213-git
 Copyright (C) 2017 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "x86_64-pc-linux-gnu".
 Type "show configuration" for configuration details.
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>.
 Find the GDB manual and other documentation resources online at:
 <http://www.gnu.org/software/gdb/documentation/>.
 For help, type "help".
 Type "apropos word" to search for commands related to "word"...
 (gdb)
~~~

This also moves the location where save_original_signals_state is
called a bit further below (to after option processing), so that "-q"
disables the warning:

~~~
 $ LD_PRELOAD=libSegFault.so gdb -q
 (gdb)
~~~

New testcase included.

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* common/signals-state-save-restore.c
	(save_original_signals_state): New parameter 'quiet'.  Warn if we
	find a custom handler preinstalled, instead of internal erroring.
	But only warn if !quiet.
	* common/signals-state-save-restore.h
	(save_original_signals_state): New parameter 'quiet'.
	* main.c (captured_main_1): Move save_original_signals_state call
	after option handling, and pass QUIET.

gdb/gdbserver/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* server.c (captured_main): Pass quiet=false to
	save_original_signals_state.

gdb/testsuite/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* gdb.base/libsegfault.exp: New.


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [binutils-gdb/gdb-8.1-branch] Fix GDB build failure when $development is false
@ 2018-01-08 11:59 sergiodj+buildbot
  2018-01-08 14:40 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-08 11:59 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 6caf4baae5fc2ea553b981eeb9533ce287e7b86c ***

Author: Yao Qi <yao.qi@linaro.org>
Branch: gdb-8.1-branch
Commit: 6caf4baae5fc2ea553b981eeb9533ce287e7b86c

Fix GDB build failure when $development is false

We don't build GDB selftests bits when $development is false.  However, if
we turn bfd/development.sh:$development to false, common/selftest.c is
compiled which is not expected.  It causes the build failure,

selftest.o: In function `selftests::run_tests(char const*)':
binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()'
collect2: error: ld returned 1 exit status

I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS
only when $development is true.  After this is fixed, there are other
build failures in maint.c, this patch fixes them as well.

In the release mode, the output of these commands are:

(gdb) maintenance selftest
Selftests are not available in a non-development build.
(gdb) maintenance selftest foo
Selftests are not available in a non-development build.
(gdb) maintenance info selftests
Selftests are not available in a non-development build.

gdb:

2018-01-08  Yao Qi  <yao.qi@linaro.org>
	    Simon Marchi  <simon.marchi@ericsson.com>

	* Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
	common/selftest.c.
	(COMMON_OBS): Remove selftest.o.
	* configure.ac: Append selftest-arch.c and common/selftest.c to
	CONFIG_SRCS.  Append selftest-arch.o and selftest.o to COMMON_OBS.
	* configure: Re-generated.
	* maint.c (maintenance_selftest): Wrap selftests::run_tests with
	GDB_SELF_TEST.
	(maintenance_info_selftests): Likewise.

gdb/testsuite:

2018-01-08  Simon Marchi  <simon.marchi@ericsson.com>

	* gdb.gdb/unittest.exp: Match output in non-development mode.


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [binutils-gdb/gdb-8.1-branch] Fix gdb/spu-tdep.c build breakage
@ 2018-01-05 19:24 sergiodj+buildbot
  2018-01-05 22:13 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-05 19:24 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 1dc9069e0620fafe99628cd7d849033161258074 ***

Author: Pedro Alves <palves@redhat.com>
Branch: gdb-8.1-branch
Commit: 1dc9069e0620fafe99628cd7d849033161258074

Fix gdb/spu-tdep.c build breakage

Commit de63c46b549d ("Fix regresssion(internal-error) printing
subprogram argument (PR gdb/22670)") missed updating spu-tdep.c for
the block_lookup_symbol interface change, resulting in:

  ../../binutils-gdb/gdb/spu-tdep.c: In function void spu_catch_start(objfile*):
  ../../binutils-gdb/gdb/spu-tdep.c:1969:59: error: cannot convert domain_enum_tag to symbol_name_match_type for argument 3 to symbol* block_lookup_symbol(const block*, const char*, symbol_name_match_type, domain_enum)
	 sym = block_lookup_symbol (block, "main", VAR_DOMAIN);
							     ^

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	* spu-tdep.c (spu_catch_start): Pass
	symbol_name_match_type::SEARCH_NAME to block_lookup_symbol.


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [binutils-gdb/gdb-8.1-branch] Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670)
@ 2018-01-05 18:31 sergiodj+buildbot
  2018-01-05 20:36 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-05 18:31 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT a76cf1f43d27f022562d9e70eb91e212dbd0da4a ***

Author: Pedro Alves <palves@redhat.com>
Branch: gdb-8.1-branch
Commit: a76cf1f43d27f022562d9e70eb91e212dbd0da4a

Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670)

At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel
wrote:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following code which first declares a tagged type (the
equivalent of a class in Ada), and then a procedure which takes a
pointer (access) to this type's 'Class.

    package Pck is
       type Top_T is tagged record
          N : Integer := 1;
       end record;
       procedure Inspect (Obj: access Top_T'Class);
    end Pck;

Putting a breakpoint in that procedure and then running to it triggers
an internal error:

    (gdb) break inspect
    (gdb) continue
    Breakpoint 1, pck.inspect (obj=0x63e010
    /[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed.

What's special about this subprogram is that it takes an access to
what we call a 'Class type, and for implementation reasons, the
compiler adds an extra argument named "objL". If you are curious why,
it allows the compiler for perform dynamic accessibility checks that
are mandated by the language.

If we look at the location where we get the internal error (in
stack.c), we find that we are looping over the symbol of each
parameter, and for each parameter, we do:

    /* We have to look up the symbol because arguments can have
       two entries (one a parameter, one a local) and the one we
       want is the local, which lookup_symbol will find for us.
    [...]
        nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
                              b, VAR_DOMAIN, NULL).symbol;
        gdb_assert (nsym != NULL);

The lookup_symbol goes through the lookup structure, which means the
symbol's linkage name ("objL") gets transformed into a
lookup_name_info object (in block_lookup_symbol), before it gets fed
to the block symbol dictionary iterators.  This, in turn, triggers the
symbol matching by comparing the "lookup" name which, for Ada, means
among other things, lowercasing the given name to "objl".  It is this
transformation that causes the lookup find no matches, and therefore
trip this assertion.

Going back to the "offending" call to lookup_symbol in stack.c, what
we are trying to do, here, is do a lookup by linkage name.  So, I
think what we mean to be doing is a completely literal symbol lookup,
so maybe not even strcmp_iw, but actually just plain strcmp???

In the past, in practice, you could get that effect by doing a lookup
using the C language. But that doesn't work, because we still end up
somehow using Ada's lookup_name routine which transforms "objL".

So, ideally, as I hinted before, I think what we need is a way to
perform a literal lookup so that searches by linkage names like the
above can be performed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This commit fixes the problem by implementing something similar to
Joel's literal idea, but with some important differences.

I considered adding a symbol_name_match_type::LINKAGE and supporting
searching by linkage name for any language, but the problem with that
is that the dictionaries only work with SYMBOL_SEARCH_NAME, because
that's what is used for hashing.  We'd need separate dictionaries for
hashed linkage names.

So with the current symbol tables infrastructure, it's not literal
linkage names that we want to pass down, but instead literal _search_
names (SYMBOL_SEARCH_NAME, etc.).

However, psymbols have no overload/function parameter info in C++, so
a straight strcmp doesn't work properly for C++ name matching.

So what we do is be a little less aggressive then and add a new
symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a
non-user-input search symbol, and then we skip any decoding/demangling
steps and make:

 - Ada treat that as a verbatim match,
 - other languages treat it as symbol_name_match_type::FULL.

This also fixes the new '"maint check-psymtabs" for Ada' testcase for
me (gdb.ada/maint_with_ada.exp).  I've not removed the kfail yet
because Joel still sees that testcase failing with this patch.
That'll be fixed in follow up patches.

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/22670
	* ada-lang.c (literal_symbol_name_matcher): New function.
	(ada_get_symbol_name_matcher): Use it for
	symbol_name_match_type::SEARCH_NAME.
	* block.c (block_lookup_symbol): New parameter 'match_type'.  Pass
	it down instead of assuming symbol_name_match_type::FULL.
	* block.h (block_lookup_symbol): New parameter 'match_type'.
	* c-valprint.c (print_unpacked_pointer): Use
	lookup_symbol_search_name instead of lookup_symbol.
	* compile/compile-object-load.c (get_out_value_type): Pass down
	symbol_name_match_type::SEARCH_NAME.
	* cp-namespace.c (cp_basic_lookup_symbol): Pass down
	symbol_name_match_type::FULL.
	* cp-support.c (cp_get_symbol_name_matcher): Handle
	symbol_name_match_type::SEARCH_NAME.
	* infrun.c (insert_exception_resume_breakpoint): Use
	lookup_symbol_search_name.
	* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
	* psymtab.c (maintenance_check_psymtabs): Use
	symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
	* stack.c (print_frame_args): Use lookup_symbol_search_name and
	SYMBOL_SEARCH_NAME.
	* symtab.c (lookup_local_symbol): Don't demangle the lookup name
	if symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_in_language): Pass down
	symbol_name_match_type::FULL.
	(lookup_symbol_search_name): New.
	(lookup_language_this): Pass down
	symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_aux, lookup_local_symbol): New parameter
	'match_type'.  Pass it down.
	* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
	(lookup_symbol_search_name): New declaration.
	(lookup_symbol_in_block): New 'match_type' parameter.

gdb/testsuite/ChangeLog:
2018-01-05  Joel Brobecker  <brobecker@adacore.com>

	PR gdb/22670
	* gdb.ada/access_tagged_param.exp: New file.
	* gdb.ada/access_tagged_param/foo.adb: New file.


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [binutils-gdb/gdb-8.1-branch] Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670)
@ 2018-01-05 16:37 sergiodj+buildbot
  2018-01-05 17:21 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-05 16:37 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 7a19098f86ba3a4abfeb4dff33e2a1929f6fbaa8 ***

Author: Pedro Alves <palves@redhat.com>
Branch: gdb-8.1-branch
Commit: 7a19098f86ba3a4abfeb4dff33e2a1929f6fbaa8

Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670)

The comments about mixed case in the testcase are actually a red
herring.  The problem here is that we'd get to
ada_lookup_encoded_symbol with "my_table", which wraps the looked up
name in "<>"s to force a verbatim match, and that in turn disables
wild matching.

Fix this by swapping around the internals of ada_lookup_encoded_symbol
and ada_lookup_symbol, thus avoiding the encoding and
verbatim-wrapping in the ada_lookup_symbol case, the case that starts
with a user-provided lookup name.

Ada encoding is still done of course, in the ada_lookup_name_info
ctor.  This could be also seen as avoiding the double-encoding problem
in a different way.

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/22670
	* ada-lang.c (ada_lookup_encoded_symbol): Reimplement in terms of
	ada_lookup_symbol.
	(ada_lookup_symbol): Reimplement in terms of
	ada_lookup_symbol_list, bits factored out from
	ada_lookup_encoded_symbol.

gdb/testsuite/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/22670
	* gdb.ada/info_addr_mixed_case.exp: Remove kfail.  Extend test to
	exercise lower case too, and to exercise both full matching and
	wild matching.


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [binutils-gdb/gdb-8.1-branch] Set development mode to "off" by default.
@ 2018-01-05  5:25 sergiodj+buildbot
  2018-01-05  5:59 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
  0 siblings, 1 reply; 19+ messages in thread
From: sergiodj+buildbot @ 2018-01-05  5:25 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 7a9dac5b3cc3b50f9733deef0a606c28b099ed1f ***

Author: Joel Brobecker <brobecker@adacore.com>
Branch: gdb-8.1-branch
Commit: 7a9dac5b3cc3b50f9733deef0a606c28b099ed1f

Set development mode to "off" by default.

bfd/ChangeLog:

	* development.sh (development): Set to false.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-01-08 14:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 20:29 [binutils-gdb/gdb-8.1-branch] Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7) sergiodj+buildbot
2018-01-05 20:29 ` *** COMPILATION FAILED *** Failures on Fedora-i686, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
2018-01-05 20:30 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot
2018-01-05 20:33 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2018-01-05 20:36 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-m32, " sergiodj+buildbot
2018-01-05 20:36 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-05 20:38 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-01-05 20:41 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-01-05 20:42 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-01-05 23:54 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, " sergiodj+buildbot
2018-01-06  0:09 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-m64, " sergiodj+buildbot
2018-01-06  6:18 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-06  6:35 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-01-06  6:50 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot
  -- strict thread matches above, loose matches on Subject: below --
2018-01-08 11:59 [binutils-gdb/gdb-8.1-branch] Fix GDB build failure when $development is false sergiodj+buildbot
2018-01-08 14:40 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
2018-01-05 19:24 [binutils-gdb/gdb-8.1-branch] Fix gdb/spu-tdep.c build breakage sergiodj+buildbot
2018-01-05 22:13 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
2018-01-05 18:31 [binutils-gdb/gdb-8.1-branch] Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670) sergiodj+buildbot
2018-01-05 20:36 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
2018-01-05 16:37 [binutils-gdb/gdb-8.1-branch] Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670) sergiodj+buildbot
2018-01-05 17:21 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot
2018-01-05  5:25 [binutils-gdb/gdb-8.1-branch] Set development mode to "off" by default sergiodj+buildbot
2018-01-05  5:59 ` *** COMPILATION FAILED *** Failures on Ubuntu-AArch64-native-gdbserver-m64, branch gdb-8.1-branch *** BREAKAGE *** sergiodj+buildbot

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).