Tom Tromey [Wed, 13 Nov 2019 01:20:58 +0000 (18:20 -0700)]
Display "main" on initial TUI startup
I noticed that even when there's a symbol file, "tui enable" won't
show "main" by default. I think it should, and this patch fixes this.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Call tui_display_main.
gdb/testsuite/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* gdb.tui/list.exp: Check for source on initial listing.
Change-Id: Ic7bfc930e1179f5b61111e30a2dae46a98b00064
Tom Tromey [Wed, 13 Nov 2019 01:20:32 +0000 (18:20 -0700)]
Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it. I think this is incorrect in two ways.
First, it should probably instead use the user's most recent source
context, if one has been set.
Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.
This patch fixes both of these problems.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Use
get_current_source_symtab_and_line, and main_name.
Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
Tom Tromey [Wed, 13 Nov 2019 01:04:01 +0000 (18:04 -0700)]
Simplify tui_update_source_windows_with_line
This changes tui_update_source_windows_with_line to take a
symtab_and_line, rather than separate parameters, and then updates the
caller.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
a symtab_symbol_info, not a separate symtab and line. Simplify.
Change-Id: I8803a0a6fd2938ceee859aea53a57ce582f3e80d
Tom Tromey [Wed, 13 Nov 2019 00:59:06 +0000 (17:59 -0700)]
Simplify tui_update_source_windows_with_addr
After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each. So, it can be simplified by using a loop instead.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_addr):
Simplify.
Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
Tom Tromey [Wed, 13 Nov 2019 00:56:42 +0000 (17:56 -0700)]
Use symtab_and_line when updating TUI windows
This changes a few TUI source window methods to take a symtab_and_line
rather than separate symtab and tui_line_or_address parameters. A
symtab_and_line already incorporates the same information, so this
seemed simpler. Also, it helps avoid the problem that the source and
disassembly windows need different information -- both forms are
present in the SAL.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<set_contents, update_source_window_as_is, update_source_window>:
Take a sal, not a separate symtab and tui_line_or_address.
* tui/tui-winsource.c (tui_source_window_base::update_source_window)
(tui_source_window_base::update_source_window_as_is): Take a sal,
not a separate symtab and tui_line_or_address.
(tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line)
(tui_source_window_base::rerender)
(tui_source_window_base::refill): Update.
* tui/tui-source.h (struct tui_source_window) <set_contents>: Take
a sal, not a separate symtab and tui_line_or_address.
* tui/tui-source.c (tui_source_window::set_contents): Take a sal,
not a separate symtab and tui_line_or_address.
(tui_source_window::maybe_update): Update.
* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Take
a sal, not a separate symtab and tui_line_or_address.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Take a sal,
not a separate symtab and tui_line_or_address.
(tui_disasm_window::do_scroll_vertical)
(tui_disasm_window::maybe_update): Update.
Change-Id: I6974a03589930a0f910c657ef50b7f6f7397c87d
Tom Tromey [Wed, 13 Nov 2019 00:40:33 +0000 (17:40 -0700)]
Use start_line_or_addr in TUI windows
A few spots in the TUI source and disassembly windows referred to
content[0], where start_line_or_addr is equivalent. This patch makes
this substitution.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_source_window_base::refill): Use
start_line_or_addr.
* tui/tui-source.c (tui_source_window::do_scroll_vertical): Use
start_line_or_addr.
* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Use
start_line_or_addr.
Change-Id: I1fa807321cd7ad88b3cc5e41cc50f4d4e2d46271
Tom Tromey [Wed, 13 Nov 2019 00:26:50 +0000 (17:26 -0700)]
Change tui_source_window_base::set_contents to return bool
This changes tui_source_window_base::set_contents to return bool,
rather than tui_status. It also changes one implementation of
set_contents to use early returns rather than a variable, which IMO
makes it easier to follow.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<set_contents>: Return bool.
* tui/tui-winsource.c
(tui_source_window_base::update_source_window_as_is): Update.
* tui/tui-source.h (struct tui_source_window) <set_contents>:
Return bool.
* tui/tui-source.c (tui_source_window::set_contents): Return
bool. Simplify.
* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
Return bool.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Return
bool.
Change-Id: I8c5212400cd7aadf35760c22d5344cd3b9435674
Tom Tromey [Wed, 13 Nov 2019 00:23:18 +0000 (17:23 -0700)]
Remove tui_source_window::show_symtab_source
tui_source_window::show_symtab_source is identical to
update_source_window, so remove the former.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line): Call update_source_window.
* tui/tui-source.h (struct tui_source_window)
<show_symtab_source>: Don't declare.
* tui/tui-source.c (tui_source_window::show_symtab_source):
Remove.
Change-Id: I41781df2126e8bafad46d058532d52602a288e06
Tom Tromey [Wed, 13 Nov 2019 00:19:59 +0000 (17:19 -0700)]
Remove tui_show_disassem
tui_show_disassem is just a wrapper for the update_source_window
method, and it only has a single caller. This removes the function
and inlines the logic into that caller.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
update_source_window directly.
* tui/tui-disasm.h (tui_show_disassem): Don't declare.
* tui/tui-disasm.c (tui_show_disassem): Remove.
Change-Id: I7ae7a3309f64a4a949c07a80c46e1664c7f12913
Tom Tromey [Wed, 13 Nov 2019 00:15:12 +0000 (17:15 -0700)]
Remove some unnecessary focus switches
A couple of lower-level utility functions can change the TUI focus.
This seems incorrect to me -- focus switches should only be done
either by explicit user request, or ass a side effect of changing the
layout.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c
(tui_source_window_base::update_source_window_as_is): Don't switch focus.
* tui/tui-disasm.c (tui_show_disassem): Don't switch focus.
Change-Id: I0a5bb8a407cf8d52e2fd23b0598eb9bce56b1251
Tom Tromey [Wed, 13 Nov 2019 00:08:25 +0000 (17:08 -0700)]
Simplify tui_source_window_base::maybe_update method
tui_source_window_base::maybe_update takes a symtab_and_line, plus a
separate line number and PC. Because a symtab_and_line already holds
a line number and a PC, it is possible to remove these extra
parameters.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<maybe_update>: Remove line_no and addr parameters.
* tui/tui-stack.c (tui_show_frame_info): Set PC on sal. Update.
* tui/tui-source.h (struct tui_source_window) <maybe_update>:
Update.
* tui/tui-source.c (tui_source_window::maybe_update): Remove
line_no and addr parameters.
* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
Update.
* tui/tui-disasm.c (tui_disasm_window::maybe_update): Remove
line_no and addr parameters.
Change-Id: I33d8e1a669a179544edb4197f5f7c5429dfc368e
Tom Tromey [Wed, 13 Nov 2019 00:02:49 +0000 (17:02 -0700)]
Remove some TUI asserts
This removes a few asserts from the TUI. These asserts aren't useful,
because they simply check an invariant that's already ensured by the
type system.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_source_window_base::set_is_exec_point_at)
(tui_source_window_base::update_breakpoint_info): Remove asserts.
Change-Id: I807e1e9bdb0cfa475e70375ceca3a5d4f2eb8d0b
Tom Tromey [Wed, 6 Nov 2019 23:09:28 +0000 (16:09 -0700)]
Remove tui_show_disassem_and_update_source
tui_show_disassem_and_update_source only has a single caller. This
patch simplifies that caller, by having it call tui_show_disassem, and
then removes tui_show_disassem_and_update_source.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
tui_show_disassem.
* tui/tui-disasm.h (tui_show_disassem_and_update_source): Don't
declare.
* tui/tui-disasm.c (tui_show_disassem_and_update_source): Remove.
Change-Id: I7554eca8e259f3539ea7710f2ff369b4a630dd9d
Tom Tromey [Tue, 12 Nov 2019 23:30:24 +0000 (16:30 -0700)]
Remove parameters from tui_show_source
tui_show_source does not need its parameters, so this removes them.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui.h (tui_show_source): Remove parameters.
* tui/tui.c (tui_show_source): Remove parameters.
* tui/tui-out.c (tui_ui_out::do_field_string): Update.
Change-Id: I7cbcf20175b459c269549f1832d4fb844cc573db
Tom Tromey [Tue, 12 Nov 2019 23:28:40 +0000 (16:28 -0700)]
Change tui_update_locator_fullname to take a symtab
This changes tui_update_locator_fullname to take a symtab. This
somewhat consolidates the "??" handling.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.c (tui_display_main): Update.
* tui/tui-stack.h (tui_update_locator_fullname): Change parameter
to symtab.
* tui/tui-stack.c (tui_update_locator_fullname): Change parameter
to symtab.
* tui/tui-disasm.c (tui_show_disassem_and_update_source): Update.
Change-Id: Ic61749517b44ac68561d829ff81f16976b830dec
Tom Tromey [Wed, 20 Nov 2019 23:39:44 +0000 (16:39 -0700)]
Make isearch change readline prompt in TUI
PR tui/23619 points out that isearch changes the prompt in the CLI gdb
(and in Bash) -- but not in the TUI. This turns out to be easily
fixed by removing tui_rl_saved_prompt and instead using the prompt
that readline computes.
This is stored in rl_display_prompt, which according to git was added
in readline 6.2.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
PR tui/23619:
* tui/tui-io.c (tui_rl_saved_prompt): Remove.
(tui_redisplay_readline): Use rl_display_prompt.
(tui_prep_terminal): Update.
Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
Alan Modra [Fri, 20 Dec 2019 07:26:35 +0000 (17:56 +1030)]
PR25281, sh disassembler abort
PR 25281
* sh-dis.c (print_insn_ddt): Properly check validity of MOVX_NOPY
and MOVY_NOPX insns. For invalid cases include 0xf000 in the word
printed. Print .word in more cases.
Alan Modra [Fri, 20 Dec 2019 04:07:44 +0000 (14:37 +1030)]
ubsan: or1k: left shift of negative value
cpu/
* or1korbis.cpu (f-disp26, f-disp21): Don't left shift negative values.
opcodes/
* or1k-ibld.c: Regenerate.
Alan Modra [Fri, 20 Dec 2019 02:14:33 +0000 (12:44 +1030)]
ubsan: xtensa: left shift cannot be represented in type 'int'
* xtensa-isa.c (xtensa_insnbuf_from_chars): Avoid signed overflow.
Alan Modra [Fri, 20 Dec 2019 01:44:19 +0000 (12:14 +1030)]
ubsan: hppa: left shift of negative value
bfd/
* libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
declaration. Move ATTRIBUTE_UNUSED to definition.
(sign_extend, low_sign_extend, sign_unext, low_sign_unext),
(re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16),
(re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make
args and return value unsigned. Use unsigned variables.
(hppa_rebuild_insn): Similarly.
opcodes/
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use
unsigned variables.
Alan Modra [Fri, 20 Dec 2019 00:26:29 +0000 (10:56 +1030)]
ubsan: m68hc1x: left shift of negative value
* m68hc11-dis.c (read_memory): Delete forward decls.
(print_indexed_operand, print_insn): Likewise.
(print_indexed_operand): Formatting. Don't rely on short being
exactly 16 bits, make sign extension explicit.
(print_insn): Likewise. Avoid signed overflow.
Alan Modra [Thu, 19 Dec 2019 23:33:30 +0000 (10:03 +1030)]
bfd_check_format memory leak
* format.c (bfd_check_format_matches): Free matching_vector when
not returning matching target strings.
Alan Modra [Thu, 19 Dec 2019 23:31:03 +0000 (10:01 +1030)]
coff-alpha memory leak
* coff-alpha.c (alpha_ecoff_read_ar_hdr): Free ar_hdr on error return.
GDB Administrator [Fri, 20 Dec 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Wed, 18 Dec 2019 21:03:07 +0000 (15:03 -0600)]
Consistently quote variables used with "test"
This ensures that empty variables and variables with spaces are handled
correctly.
Code was inconsistent on whether the constant string (e.g. yes/no)
should also be quoted; I tried to be consistent with surrounding code.
This fixes the error Eli reported during configure with mingw (though that
was not fatal).
gdb/ChangeLog:
2019-12-19 Christian Biesinger <cbiesinger@google.com>
* configure: Regenerate.
* configure.ac: Quote variable arguments of test.
* gdbsupport/common.m4: Likewise.
gdb/gdbserver/ChangeLog:
2019-12-19 Christian Biesinger <cbiesinger@google.com>
* configure: Regenerate.
* configure.ac: Quote variable arguments of test.
Change-Id: I220e78b52c7db88b9dd058eda604635b03464fac
Bernd Edlinger [Fri, 13 Dec 2019 16:21:21 +0000 (17:21 +0100)]
Fix build with GNU Make 3.81
GNU Make 3.81 is apparently confused when the same
source file is processed by a pattern rule and an
explicit rule at the same time with different output file.
The pattern %.o: ../%.c and alloc-ipa.o: ../alloc.c
both have the source ../alloc.c but two independent
object files alloc.o and alloc-ipa.o, so
while building gdbserver I see the following message:
make[4]: Circular alloc-ipa.o <- ../alloc.c dependency dropped.
CXX alloc-ipa.o
g++: warning: '-x c++' after last input file has no effect
g++: fatal error: no input files
compilation terminated.
In the make debug output I see the pattern is first correct:
alloc-ipa.o: ../alloc.c | config.h build-gnulib-gdbserver/import/string.h
$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
$(POSTCOMPILE)
But after the "Circular" dependency is dropped, the pattern
is changed to:
alloc-ipa.o: | config.h build-gnulib-gdbserver/import/string.h
$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
$(POSTCOMPILE)
So indeed now $< is empty, and the build step fails.
This happens only when alloc.o needs to be built, when alloc.o
was already built, the build succeeds, but it takes often
several attempts until the build succeeds.
By rewriting the alloc-ipa.c: ../alloc.c rule into a pattern
rule, the problem goes away.
While already at it, this patch removes also the
$(WARN_CFLAGS_NO_FORMAT) from the build rule, which is just a
copy/paste thing that is not necessary for alloc.c at all.
Christian Biesinger [Wed, 18 Dec 2019 23:56:17 +0000 (17:56 -0600)]
Make the literal argument to pow a double, not an integer
Since pow takes doubles, pass 2.0 instead of 2 to pow ().
Conveniently, this fixes the ambiguous call to pow on Solaris 11
with gcc 5.5 (gcc211 on the compile farm), which has a "using std::pow"
directive in a system header, which brings in float/double/long double
overloads. Fixes the build on Solaris with enable-targets=all.
gdb/ChangeLog:
2019-12-19 Christian Biesinger <cbiesinger@google.com>
* score-tdep.c (score7_analyze_prologue): Pass 2.0 instead of
2 to pow ().
Change-Id: Ib18e7e4749ddcbff0727b72a31198f8cb84d1993
Christian Biesinger [Wed, 18 Dec 2019 23:50:33 +0000 (17:50 -0600)]
Cast the log10 argument to double to disambiguate it
On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a
using std::log10; directive. This is unfortunate because std::log10 has
overloads for float/double/long double. To disambiguate this call,
cast the argument to double to fix the build.
gdb/ChangeLog:
2019-12-19 Christian Biesinger <cbiesinger@google.com>
* tui/tui-source.c (tui_source_window::set_contents): Cast argument of
log10 to double to fix Solaris 11 with gcc 5.5.
Change-Id: I6c0c52e9c172b529c899a435d430e5916aeef69f
Christian Biesinger [Wed, 18 Dec 2019 22:50:55 +0000 (16:50 -0600)]
Rename "sun" variable to avoid conflicts on Solaris
A Solaris system header has a #define for "sun". This renames
that variable to avoid the conflict, fixing a build error with
--enable-targets=all on Solaris.
gdb/ChangeLog:
2019-12-19 Christian Biesinger <cbiesinger@google.com>
* fbsd-tdep.c (fbsd_info_proc_files_entry): Rename local var
"sun" to "saddr_un".
Change-Id: I07a5cd801db1e28ccab8a473ebad74d7afe017c2
Tom Tromey [Wed, 18 Dec 2019 15:50:57 +0000 (08:50 -0700)]
Add install-strip to sim/
PR build/24572 notes that "make install-strip" fails. For me, it
works in every directory except "sim", so this patch adds
install-strip targets to the Makefiles that appear there.
sim/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
* Makefile.in (install-strip): New target.
sim/common/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
* Makefile.in (install-strip): New target.
sim/igen/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
* Makefile.in (install-strip): New target.
sim/ppc/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
* Makefile.in (install-strip): New target.
sim/testsuite/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
PR build/24572:
* Makefile.in (install-strip): New target.
Change-Id: I76613bc5c7e7812284f33826f8a5d914477fcdc5
Tom Tromey [Thu, 19 Dec 2019 18:12:29 +0000 (11:12 -0700)]
Fix comment in field_kind
Christian pointed out that the new comment in field_kind is
un-grammatical. This fixes it.
gdb/ChangeLog
2019-12-19 Tom Tromey <tromey@adacore.com>
* ui-out.h (enum class field_kind): Fix comment.
Change-Id: I6608ff18e29f1af98a0ff77012afe28b3d4602f4
Tom Tromey [Tue, 10 Dec 2019 18:44:36 +0000 (11:44 -0700)]
Handle CRLF when reading XML on Windows
xml-support.c uses FOPEN_RT, but then reads the entire contents of the
file and verifies that the number of bytes read matches the length.
This can fail on Windows, where the read will translate line
terminators.
This patch fixes the bug by changing xml-support.c to use FOPEN_RB.
This works because expat correctly handles \r\n line terminators.
gdb/ChangeLog
2019-12-11 Tom Tromey <tromey@adacore.com>
* xml-support.c (xml_fetch_content_from_file): Use FOPEN_RB.
gdb/testsuite/ChangeLog
2019-12-11 Tom Tromey <tromey@adacore.com>
* gdb.xml/tdesc-arch.exp (set_arch): Add "trans_mode" parameter.
Add crlf test.
Change-Id: I548438f33eed284dde1de8babf755eaa1a40319d
Alan Modra [Thu, 19 Dec 2019 11:16:01 +0000 (21:46 +1030)]
xcoff slurp_armap bounds checking
"count * 8 >= size" might overflow, "count >= size / 8" doesn't.
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Don't overflow when
checking symbol count against section size. Guard against strlen
running off end of buffer by allocating one more byte and zeroing.
* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
Alan Modra [Thu, 19 Dec 2019 05:08:39 +0000 (15:38 +1030)]
vax decoding of indexed addressing mode
This patch prevents print_insn_mode recursing into another index mode
byte, which if repeated enough times will overflow private.the_buffer
and scribble over other memory.
* vax-dis.c (print_insn_mode): Stop index mode recursion.
Alan Modra [Thu, 19 Dec 2019 04:47:12 +0000 (15:17 +1030)]
PowerPC, use size_t rather than long for indices
This is fussing about nothing really but since I was looking at signed
vs. unsigned issues, I decided to use the correct types here.
* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Use size_t for vars.
* elf64-ppc.c (sym_exists_at): Use size_t for lo, hi and mid.
Alan Modra [Thu, 19 Dec 2019 02:21:23 +0000 (12:51 +1030)]
Re: Enable --build-id for moxie-elf-ld
* testsuite/lib/ld-lib.exp (uses_genelf): Remove moxie.
Dr N.W. Filardo [Thu, 19 Dec 2019 00:14:50 +0000 (10:44 +1030)]
PR25277, microblaze opcode enumeration vs ISO/IEC TS 18661-3:2015
fadd, fmul, and fdiv are now, by ISO/IEC TS 18661-3:2015, defined to
refer to functions from the runtime subsystem.
PR 25277
* microblaze-opcm.h (enum microblaze_instr): Prefix fadd, fmul and
fdiv with "mbi_".
* microblaze-opc.h (opcodes): Adjust to suit.
GDB Administrator [Thu, 19 Dec 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 18 Dec 2019 21:46:17 +0000 (16:46 -0500)]
Update gdb.base/default.exp for GDB 10
Now that the version number in master has been bumped to 10, I get this
failure:
FAIL: gdb.base/default.exp: show convenience ($_gdb_major = 9 not found)
Update the test accordingly.
gdb/testsuite/ChangeLog:
* gdb.base/default.exp: Update value of $_gdb_major.
Anthony Green [Wed, 18 Dec 2019 19:55:35 +0000 (14:55 -0500)]
2019-12-18 Anthony Green <green@moxielogic.com>
* emulparams/elf32moxie.sh (TEMPLATE_NAME): Switch to elf template
to enable --build-id.
* configure.tgt: Don't define targ_extra_ofiles for moxie-*-*.
Tom Tromey [Wed, 18 Dec 2019 18:45:51 +0000 (11:45 -0700)]
Fix pthread_setname_np build error
My earlier patch to fix the pthread_setname_np build error on macOS
was incorrect. While the macOS man page claims that
pthread_setname_np returns void, in <pthread.h> it is actually
declared returning "int". I knew this earlier, but must have made
some mistake when preparing the patch for submission (perhaps when
removing the templates?).
This patch re-fixes the bug. I'm also applying it to the 9.1 branch.
Tested by building on macOS High Sierra.
gdb/ChangeLog
2019-12-18 Tom Tromey <tromey@adacore.com>
PR build/25268:
* gdbsupport/thread-pool.c (set_thread_name): Expect "int" return
type on macOS. Add comment.
Change-Id: Ib09da6ac33958a0d843f65df2a528112356e7de6
Simon Marchi [Wed, 18 Dec 2019 18:27:18 +0000 (13:27 -0500)]
Fix indentation (and clang warning) in c-lang.c
I see this warning when building with clang:
CXX c-lang.o
/home/smarchi/src/binutils-gdb/gdb/c-lang.c:314:7: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
*length = i * width;
^
/home/smarchi/src/binutils-gdb/gdb/c-lang.c:308:4: note: previous statement is here
if (extract_unsigned_integer (contents + i * width,
^
It took me a while to notice that some lines in that area have a
spurious space before the tabs, at the beginning of the ling. I'm not
sure how clang translates that to misleading indentation, but making the
indentation correct gets rid of the error.
There are many more instances of this in the code base (`grep -P '^ \t'
*.c`), if others think it's a good idea, it would be pretty easy to fix
them all up in one shot.
gdb/ChangeLog:
* c-lang.c (c_get_string, asm_language_defn): Remove space
before tab.
Tom Tromey [Wed, 18 Dec 2019 15:03:01 +0000 (08:03 -0700)]
Fix build failure on macOS
PR build/25250 notes that the gdb 9 pre-release fails to build on
macOS, due to a name clash between field_kind::STRING and the STRING
token in ada-exp.y. I am not sure (I couldn't reproduce this myself),
but presumably this is due to differences caused by the version of
bison in use there.
This patch works around the problem by renaming the field_kind
enumerator. I chose to rename this one because it is used in
relatively few places -- it's just an implementation detail of the
style code.
This version also renames field_kind::SIGNED for consistency.
Let me know what you think. I intend to check this in on the gdb 9
branch as well.
gdb/ChangeLog
2019-12-18 Tom Tromey <tromey@adacore.com>
PR build/25250:
* ui-out.c (ui_out::vmessage): Update.
* ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>:
Rename.
(string_field): Update.
(signed_field): Update.
Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4
Simon Marchi [Wed, 18 Dec 2019 17:25:46 +0000 (12:25 -0500)]
Fix -Wmisleading-indentation warning in top.c
When building top.c with this clang (daily build from apt.llvm.org):
$ clang++-10 --version
clang version 10.0.0-+
20191211091425+
f99297176cd-1~exp1~
20191211082036.1372
I get:
/home/smarchi/src/binutils-gdb/gdb/top.c:1549:5: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
fprintf_filtered (stream, _("\n\
^
/home/smarchi/src/binutils-gdb/gdb/top.c:1543:3: note: previous statement is here
if (SYSTEM_GDBINIT_DIR[0])
^
This looks like a legitimate warning, the fprintf_filtered is too much
indented. Fix it, and at the same time add a bit of whitespace to make
this function easier to read.
gdb/ChangeLog:
* top.c (print_gdb_configuration): Adjust indentation.
Alan Modra [Wed, 18 Dec 2019 12:33:28 +0000 (23:03 +1030)]
ld signed overflow fix
* pe-dll.c (pe_get32, pe_as32): Avoid signed overflow.
Alan Modra [Wed, 18 Dec 2019 08:03:14 +0000 (18:33 +1030)]
Yet more signed overflow fixes
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): Avoid signed overflow.
* elf32-hppa.c (final_link_relocate): Likewise.
* elf32-ppc.c (_bfd_elf_ppc_at_tls_transform): Likewise.
(_bfd_elf_ppc_at_tprel_transform, is_insn_ds_form): Likewise.
(is_insn_dq_form, ppc_elf_relocate_section): Likewise.
* elf64-ppc.c (ok_lo_toc_insn, ppc64_elf_edit_toc): Likewise.
(ppc64_elf_relocate_section): Likewise.
* elfxx-mips.c (mips_elf_perform_relocation): Likewise.
* netbsd.h (N_SET_FLAGS): Likewise.
Alan Modra [Wed, 18 Dec 2019 05:07:44 +0000 (15:37 +1030)]
More signed overflow fixes
The arc fix in create_map avoiding signed overflow by casting an
unsigned char to unsigned int before shifting, shows one of the
dangers of blinding doing that. The problem in this case was that the
variable storing the value, newAuxRegister->address, was a long.
Using the unsigned cast meant that the 32-bit value was zero extended
when long is 64 bits. Previously we had a sign extension. Net result
was that comparisons in arcExtMap_auxRegName didn't match. Of course,
I could have cast the 32-bit unsigned value back to signed before
storing in a long, but it's neater to just use an unsigned int for the
address.
opcodes/
* alpha-opc.c (OP): Avoid signed overflow.
* arm-dis.c (print_insn): Likewise.
* mcore-dis.c (print_insn_mcore): Likewise.
* pj-dis.c (get_int): Likewise.
* ppc-opc.c (EBD15, EBD15BI): Likewise.
* score7-dis.c (s7_print_insn): Likewise.
* tic30-dis.c (print_insn_tic30): Likewise.
* v850-opc.c (insert_SELID): Likewise.
* vax-dis.c (print_insn_vax): Likewise.
* arc-ext.c (create_map): Likewise.
(struct ExtAuxRegister): Make "address" field unsigned int.
(arcExtMap_auxRegName): Pass unsigned address.
(dump_ARC_extmap): Adjust.
* arc-ext.h (arcExtMap_auxRegName): Update prototype.
GDB Administrator [Wed, 18 Dec 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Mon, 16 Dec 2019 21:00:17 +0000 (15:00 -0600)]
Add missing include to bsd-kvm.c for gdb_abspath
Commit
ff8577f64987a898e1dc5eb6afb66a404fb7bb16 added a call to
gdb_abspath in bsd-kvm.c, but doesn't include its header file.
This commit fixes that.
gdb/ChangeLog:
2019-12-17 Christian Biesinger <cbiesinger@google.com>
* bsd-kvm.c: Include gdbsupport/pathstuff.h.
Change-Id: I647c3620d8ae978ae27c38dbe0b3347a97c5bfc2
Simon Marchi [Tue, 17 Dec 2019 20:01:15 +0000 (15:01 -0500)]
Add virtual destructor to tui_layout_base
I stumbled on some ASan failures when using the TUI, when tearing down a
TUI layout. The simplest way to trigger it is to run:
$ ./gdb --data-directory=data-directory -batch -ex "layout next"
The ASan report is:
=================================================================
==
2829136==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x608000009a20 in thread T0:
object passed to delete has wrong type:
size of the allocated type: 88 bytes;
size of the deallocated type: 24 bytes.
#0 0x7f470fe2507e in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:177
#1 0x55f88c75700d in std::default_delete<tui_layout_base>::operator()(tui_layout_base*) const /usr/include/c++/9.2.0/bits/unique_ptr.h:81
#2 0x55f88c756328 in std::unique_ptr<tui_layout_base, std::default_delete<tui_layout_base> >::~unique_ptr() /usr/include/c++/9.2.0/bits/unique_ptr.h:284
#3 0x7f470ee536a6 in __run_exit_handlers (/usr/lib/libc.so.6+0x3e6a6)
#4 0x7f470ee5385d in __GI_exit (/usr/lib/libc.so.6+0x3e85d)
#5 0x55f88c69f2ac in quit_force(int*, int) /home/simark/src/binutils-gdb/gdb/top.c:1766
#6 0x55f88becc29a in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:1183
#7 0x55f88becc814 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1192
#8 0x55f88becc8a9 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1217
#9 0x55f88b3159cd in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
#10 0x7f470ee3c152 in __libc_start_main (/usr/lib/libc.so.6+0x27152)
#11 0x55f88b31579d in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x11fb79d)
0x608000009a20 is located 0 bytes inside of 88-byte region [0x608000009a20,0x608000009a78)
allocated by thread T0 here:
#0 0x7f470fe238f8 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:104
#1 0x55f88c750906 in tui_layout_split::clone() const /home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:515
#2 0x55f88c74e60e in show_layout /home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:90
#3 0x55f88c74e7db in tui_set_layout(tui_layout_type) /home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:116
#4 0x55f88c782f4f in tui_enable() /home/simark/src/binutils-gdb/gdb/tui/tui.c:481
#5 0x55f88c74eeb2 in tui_layout_command /home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:286
#6 0x55f88b6f969b in do_const_cfunc /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:107
#7 0x55f88b701859 in cmd_func(cmd_list_element*, char const*, int) /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:1952
#8 0x55f88c69b455 in execute_command(char const*, int) /home/simark/src/binutils-gdb/gdb/top.c:652
#9 0x55f88bec9026 in catch_command_errors /home/simark/src/binutils-gdb/gdb/main.c:400
#10 0x55f88becc1f2 in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:1167
#11 0x55f88becc814 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1192
#12 0x55f88becc8a9 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1217
#13 0x55f88b3159cd in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
#14 0x7f470ee3c152 in __libc_start_main (/usr/lib/libc.so.6+0x27152)
The problem is that the tui_layout_base is missing a virtual destructor.
We allocate a derived object (tui_layout_split), but delete it through a
tui_layout_base pointer. Since the tui_layout_base destructor is not
virtual, the derived (tui_layout_split) destructor is not called, only
the base destructor.
That code is not in gdb-9-branch, so I don't think this patch is
relevant for the stable branch.
Note that this is caught as a diagnostic with clang:
In file included from /home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:22:
In file included from /home/simark/src/binutils-gdb/gdb/defs.h:28:
In file included from /home/simark/src/binutils-gdb/gdb/gdbsupport/common-defs.h:133:
In file included from /home/simark/src/binutils-gdb/gdb/gdbsupport/common-exceptions.h:25:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/memory:80:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/unique_ptr.h:81:2: error: delete called on 'tui_layout_base' that is abstract but has non-virtual destructor [-Werror,-Wdelete-abstract-non-virtual-dtor]
delete __ptr;
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/unique_ptr.h:284:4: note: in instantiation of member function 'std::default_delete<tui_layout_base>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/home/simark/src/binutils-gdb/gdb/tui/tui-layout.c:54:41: note: in instantiation of member function 'std::unique_ptr<tui_layout_base, std::default_delete<tui_layout_base> >::~unique_ptr' requested here
static std::unique_ptr<tui_layout_base> applied_layout;
^
1 error generated.
GCC has the similar -Wdelete-non-virtual-dtor, enabled by -Wall, but it
doesn't show up because warnings are inhibited for system headers, where
std::unique_ptr is defined. There is a bug about it here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876
gdb/ChangeLog:
* tui/tui-layout.h (class tui_layout_base): Add virtual
destructor.
Bernd Edlinger [Sun, 15 Dec 2019 10:05:47 +0000 (11:05 +0100)]
Fix skip.exp test failure observed with gcc-9.2.0
We need to step a second time with this gcc version.
The first step jumps back to main before entering foo.
Previously the control flow was from bar directly to foo.
Further ananlysis suggests, that this change in behavior started
with gcc-8.1.0 when -gcolumn-info was enabled by default.
The option -gcolumn-info was first implemented in gcc-7.1.0 but
default-disabled, so you can get the altered behavior already with
gcc-7 if you manually enable -gcolumn-info.
Previously there was just one point where line 30 (of skip.c) started:
[0x00000032] Advance Line by 27 to 28
[0x00000034] Copy
[0x00000035] Special opcode 63: advance Address by 4 to 0x4004cb and Line by 2 to 30
[0x00000036] Advance PC by constant 17 to 0x4004dc
[0x00000037] Special opcode 7: advance Address by 0 to 0x4004dc and Line by 2 to 32
But with -gcolumn-info enabled, we have line 30 three times with different column:
[0x00000034] Advance Line by 27 to 28
[0x00000036] Copy
[0x00000037] Set column to 9
[0x00000039] Special opcode 63: advance Address by 4 to 0x4004c6 and Line by 2 to 30
[0x0000003a] Set column to 17
[0x0000003c] Special opcode 75: advance Address by 5 to 0x4004cb and Line by 0 to 30
[0x0000003d] Set column to 3
[0x0000003f] Special opcode 75: advance Address by 5 to 0x4004d0 and Line by 0 to 30
[0x00000040] Special opcode 105: advance Address by 7 to 0x4004d7 and Line by 2 to 32
That could probably be filtered in dwarf2read.c to keep the old behavior, but
the new behavior makes still sense, even if we cannot really make use of the
column in the line number info for now.
Bernd Edlinger [Tue, 17 Dec 2019 13:20:36 +0000 (14:20 +0100)]
Whitespace fix in gdb.base/skip.exp
Just use tabs instead of spaces here.
Alan Modra [Tue, 17 Dec 2019 12:41:02 +0000 (23:11 +1030)]
ubsan: visium: left shift cannot be represented in type 'int'
* visium-dis.c (print_insn_visium): Avoid signed overflow.
Alan Modra [Tue, 17 Dec 2019 12:18:48 +0000 (22:48 +1030)]
ubsan: aarch64: left shift cannot be represented in type 'int64_t'
* aarch64-opc.c (value_fit_signed_field_p): Avoid signed overflow.
(value_fit_unsigned_field_p): Likewise.
(aarch64_wide_constant_p): Likewise.
(operand_general_constraint_met_p): Likewise.
* aarch64-opc.h (aarch64_wide_constant_p): Update prototype.
Alan Modra [Tue, 17 Dec 2019 11:48:57 +0000 (22:18 +1030)]
ubsan: nds32: left shift cannot be represented in type 'int'
Yet more.
* nds32-dis.c (nds32_mask_opcode): Avoid signed overflow.
(print_insn_nds32): Use uint64_t for "given" and "given1".
Alan Modra [Tue, 17 Dec 2019 08:36:02 +0000 (19:06 +1030)]
Prefer object over notype symbols when disassembling
Changing objdump disassembly output like this always requires some
testsuite changes, with the avr and x64_64 changes simply due to
picking up better symbols, the whole point of the patch.
The mips changes are due to mips-sgi-irix changing STT_NOTYPE symbols
to STT_OBJECT, which objdump now chooses in preference to script
symbols. The problem is that objdump looks at the first symbol in the
section being disassembled, and if object type, just dumps out bytes
rather than disassembling. This results in new failures:
FAIL: JAL overflow 2
FAIL: undefined weak symbol overflow
FAIL: undefined weak symbol overflow (n32)
FAIL: undefined weak symbol overflow (n64)
So for mips-sgi-irix function symbols really do need to be function
type. I fixed a few more than just the required minimum to avoid the
above test fails.
binutils/
* objdump.c (compare_section): New static var.
(compare_symbols): Sort by current section only. Don't access
symbol name out of bounds when checking for file symbols.
Sort section symbols and object symbols.
(find_symbol_for_address): Remove bogus debugging and section
symbol test.
(disassemble_data): Move symbol sort from here..
(disassemble_section): ..to here. Set compare_section.
ld/
* testsuite/ld-avr/lds-mega.d: Adjust symbols to suit objdump change.
* testsuite/ld-avr/lds-tiny.d: Likewise.
* testsuite/ld-x86-64/load2.d: Likewise.
* testsuite/ld-mips-elf/compact-eh1.s: Give function symbols
function type.
* testsuite/ld-mips-elf/compact-eh1a.s: Likewise.
* testsuite/ld-mips-elf/compact-eh1b.s: Likewise.
* testsuite/ld-mips-elf/compact-eh2.s: Likewise.
* testsuite/ld-mips-elf/compact-eh3.s: Likewise.
* testsuite/ld-mips-elf/compact-eh3a.s: Likewise.
* testsuite/ld-mips-elf/eh-frame5.s: Likewise.
* testsuite/ld-mips-elf/ehdr_start-new.s: Likewise.
* testsuite/ld-mips-elf/ehdr_start-o32.s: Likewise.
* testsuite/ld-mips-elf/emit-relocs-1a.s: Likewise.
* testsuite/ld-mips-elf/jaloverflow-2.s: Likewise.
* testsuite/ld-mips-elf/jaloverflow.s: Likewise.
* testsuite/ld-mips-elf/mips16-call-global-1.s: Likewise.
* testsuite/ld-mips-elf/mips16-intermix-1.s: Likewise.
* testsuite/ld-mips-elf/mips16-pic-1b.s: Likewise.
* testsuite/ld-mips-elf/mips16-pic-4c.s: Likewise.
* testsuite/ld-mips-elf/no-shared-1-n64.s: Likewise.
* testsuite/ld-mips-elf/no-shared-1-o32.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-1b.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-2a.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-3b.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-4b.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-5a.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-6-n32c.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-6-n64c.s: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-6-o32c.s: Likewise.
* testsuite/ld-mips-elf/pie.s: Likewise.
* testsuite/ld-mips-elf/relax-jalr.s: Likewise.
* testsuite/ld-mips-elf/reloc-1a.s: Likewise.
* testsuite/ld-mips-elf/reloc-2a.s: Likewise.
* testsuite/ld-mips-elf/reloc-4.s: Likewise.
* testsuite/ld-mips-elf/reloc-5.s: Likewise.
* testsuite/ld-mips-elf/reloc-6b.s: Likewise.
* testsuite/ld-mips-elf/textrel-1.s: Likewise.
* testsuite/ld-mips-elf/undefweak-overflow.s: Likewise.
* testsuite/ld-mips-elf/undefweak-overflow.d: Adjust.
Alan Modra [Tue, 17 Dec 2019 07:16:04 +0000 (17:46 +1030)]
Accept mips-sgi-irix output in a few ld tests
mips-sgi-irix gas emits STT_OBJECT symbols where other assemblers
would use STT_NOTYPE. See mips_frob_symbol in gas/config/tc-mips.c.
Also, the section of some dynamic symbols is set to SHN_MIPS_TEXT or
SHN_MIPS_DATA. See _bfd_mips_elf_finish_dynamic_symbol in
bfd/elfxx-mips.c. These differences are visible in readelf output
and cause some tests to fail for no other good reason.
The patch fixes the following fails and removes an xfail.
FAIL: ld-elf/pr23591
FAIL: PROVIDE_HIDDEN test (auxiliary shared object)
FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared library)
* testsuite/ld-elf/pr21233-l.sd: Accept OBJECT for type and
PRC for section of symbols.
* testsuite/ld-elf/pr23591.d: Likewise.
* testsuite/ld-elf/provide-hidden-s.nd: Likewise.
* testsuite/ld-mips-elf/start.s: Make symbols function type.
* testsuite/ld-mips-elf/hash2.d: Adjust. Don't xfail irix.
Alan Modra [Tue, 17 Dec 2019 03:53:55 +0000 (14:23 +1030)]
Remove tic80 support
This is one way of fixing ubsan bug reports, just delete the code.
The assembler support was removed back in 2005 along with other
non-BFD assemblers, but somehow the remainder of the port stayed in.
bfd/
* coff-tic80.c: Delete file.
* cpu-tic80.c: Delete file.
* archures.c: Remove tic80 support.
* coffcode.h: Likewise.
* coffswap.h: Likewise.
* targets.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* Makefile.am: Likewise.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/objcopy.exp: Remove tic80 support.
* testsuite/binutils-all/objdump.exp: Likewise.
gas/
* doc/as.texi: Remove mention of tic80.
include/
* coff/tic80.h: Delete file.
* opcode/tic80.h: Delete file.
ld/
* emulparams/tic80coff.sh: Delete file.
* scripttempl/tic80coff.sc: Delete file.
* configure.tgt: Remove tic80 support.
* Makefile.am: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
opcodes/
* tic80-dis.c: Delete file.
* tic80-opc.c: Delete file.
* disassemble.c: Remove tic80 support.
* disassemble.h: Likewise.
* Makefile.am: Likewise.
* configure.ac: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
Alan Modra [Tue, 17 Dec 2019 03:56:39 +0000 (14:26 +1030)]
ubsan: bpf: left shift cannot be represented in type 'DI' (aka 'long')
cpu/
* bpf.cpu (f-imm64): Avoid signed overflow.
opcodes/
* bpf-ibld.c: Regenerate.
Bernd Edlinger [Wed, 30 Oct 2019 20:35:22 +0000 (21:35 +0100)]
Add a test case for skip with inlined functions
Bernd Edlinger [Fri, 18 Oct 2019 12:28:45 +0000 (14:28 +0200)]
Check all inline frames if they are marked for skip
This makes the skip command work in optimized builds, where skipped
functions may be inlined. Previously that was only working when
stepping into a non-inlined function.
GDB Administrator [Tue, 17 Dec 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)]
jit: make gdb_symtab::blocks an std::forward_list
This patch changes the gdb_symtab::blocks manually maintained linked
list to be an std::forward_list, simplifying memory management.
Currently, the list is sorted as blocks are created. With an
std::forward_list, it is easier (and probably a bit more efficient) to
sort them once at the end, so this is what I did.
A note about the comment on the "next" field:
/* gdb_blocks are linked into a tree structure. Next points to the
next node at the same depth as this block and parent to the
parent gdb_block. */
I don't think it's true that "next" points to the next node at the same
depth. All nodes are in a simple singly linked list, so necessarily
some node will point to some other node that isn't at the same depth.
gdb/ChangeLog:
* jit.c (struct gdb_block) <next>: Remove field.
(struct gdb_symtab) <~gdb_symtab>: Remove.
<blocks>: Change type to std::forward_list<gdb_block>.
(compare_block): Remove.
(jit_block_open_impl): Adjust to std::forward_list. Place the new
block at the beginning, don't mind about sorting.
(finalize_symtab): Adjust to std::forward_list, sort the blocks list
before using it.
Simon Marchi [Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)]
jit: c++-ify gdb_block
Add a constructor to gdb_block, change the name field to be a
gdb::unique_xmalloc_ptr. This is in preparation for using an
std::forward_list<gdb_block> in the next patch.
gdb/ChangeLog:
* jit.c (struct gdb_block): Add constructor, initialize
real_block and next fields.
<name>: Change type to gdb::unique_xmalloc_ptr.
(struct gdb_symtab) <~gdb_symtab>: Free blocks with delete.
(jit_block_open_impl): Allocate gdb_block with new.
(finalize_symtab): Adjust to gdb::unique_xmalloc_ptr.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
jit: make gdb_object::symtabs an std::forward_list
Replace the manual linked list with an std::forward_list, simplifying
the memory management. This requires allocating gdb_object with new and
free'ing it with delete.
gdb/ChangeLog:
* jit.c: Include forward_list.
(struct gdb_symtab) <next>: Remove field.
(struct gdb_object) <symtabs>: Change type to
std::forward_list<gdb_symtab>.
(jit_object_open_impl): Allocate gdb_object with new.
(jit_symtab_open_impl): Adjust to std::forward_list.
(finalize_symtab): Don't delete symtab.
(jit_object_close_impl): Adjust to std::forward_list. Free
gdb_object with delete.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
jit: c++-ify gdb_symtab
This patch makes the gdb_symtab bit more c++y, in preparation for the
next patch that will use an std::forward_list<gdb_symtab>. It changes
the fields to use automatic memory management, in the form of
std::string and gdb::unique_xmalloc_ptr, and adds a constructor and a
destructor.
gdb/ChangeLog:
* jit.c (struct gdb_symtab): Add constructor, destructor,
initialize fields.
<linetable>: Change type to unique_xmalloc_ptr.
<file_name>: Change type to std::string.
(jit_symtab_open_impl): Allocate gdb_symtab with new.
(jit_symtab_line_mapping_add_impl): Adjust.
(finalize_symtab): Adjust, call delete on stab.
Simon Marchi [Mon, 16 Dec 2019 21:30:49 +0000 (16:30 -0500)]
Fix double-free when creating more than one block in JIT debug info reader
A double-free happens when using a JIT debug info reader that creates
more than one block. In the loop that frees blocks in finalize_symtab,
at the very end, the gdb_block_iter_tmp variable is set initially, but
not changed as the loop advances. If we have two blocks, the first
iteration frees the first block, the second iteration frees the second
block, but the third iteration tries to free the second block again, as
gdb_block_iter_tmp keeps pointing on the second block.
Fix it by assigning the gdb_block_iter_tmp variable in the loop.
I have improved the jit-reader.exp test to cover this case, by adding a
second "JIT-ed" function and creating a block for it. I have renamed
the existing function to something I find a bit more descriptive. There
are no significant changes to jit-reader.exp itself, only updates
following the renaming. The important changes are in jithost.c
(generate a new function) and in jitreader.c (create a gdb_block for
that function).
This was found because of an ASan report:
$ ./gdb testsuite/outputs/gdb.base/jit-reader/jit-reader -ex "jit-reader-load /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jitreader.so" -ex r
Reading symbols from testsuite/outputs/gdb.base/jit-reader/jit-reader...
Starting program: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jit-reader
=================================================================
==
1751048==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000042eb8 at pc 0x5650ef8eec88 bp 0x7ffe52767290 sp 0x7ffe52767280
READ of size 8 at 0x604000042eb8 thread T0
#0 0x5650ef8eec87 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:768
#1 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
#2 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
#3 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#4 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#5 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#6 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
0x604000042eb8 is located 40 bytes inside of 48-byte region [0x604000042e90,0x604000042ec0)
freed by thread T0 here:
#0 0x7fbbe57376b0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x5650ef8f350b in xfree<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/common-utils.h:62
#2 0x5650ef8eeca9 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:769
#3 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
#4 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
#5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
previously allocated by thread T0 here:
#0 0x7fbbe5737cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x5650eef662f3 in xcalloc /home/simark/src/binutils-gdb/gdb/alloc.c:100
#2 0x5650ef8f34ea in xcnew<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/poison.h:122
#3 0x5650ef8ed467 in jit_block_open_impl /home/simark/src/binutils-gdb/gdb/jit.c:557
#4 0x7fbbda98620a in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:60
#5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
#6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
#7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
#8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
[snip]
gdb/ChangeLog:
* jit.c (finalize_symtab): Set gdb_block_iter_tmp in loop.
gdb/testsuite/ChangeLog:
* gdb.base/jit-reader.exp (jit_reader_test): Rename
jit_function_00 to jit_function_stack_mangle.
* gdb.base/jithost.c (jit_function_t): Rename to...
(jit_function_stack_mangle_t): ... this.
(jit_function_add_t): New typedef.
(jit_function_00_code): Rename to...
(jit_function_stack_mangle_code): ... this, make static.
(jit_function_add_code): New.
(main): Generate "add" function and call it. Adjust to changes
in jithost_abi.
* gdb.base/jithost.h (struct jithost_abi_bounds): New.
(struct jithost_abi) <begin, end>: Remove fields.
<object, function_stack_mangle, function_add>: New fields.
* gdb.base/jitreader.c (struct reader_state) <code_begin,
code_end>: Remove fields.
<func_stack_mangle>: New field.
(read_debug_info): Adjust to renaming, create block for "add"
function.
(read_sp, unwind_frame, get_frame_id): Adjust to other changes.
Tom Tromey [Fri, 13 Dec 2019 22:09:37 +0000 (15:09 -0700)]
Constify get_exec_file
I noticed that get_exec_file could return a "const char *". This
patch implements this change.
I couldn't build all the code -- but I did build Linux native and a
mingw cross.
Consequently, the NTO code has a hack, where it casts away const. I
think this can be removed, but that required more work there, and
since I couldn't compile it, I felt it best not to try.
Let me know what you think.
gdb/ChangeLog
2019-12-16 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat_target::attach): Update.
* remote.c (extended_remote_target::attach): Update.
* procfs.c (procfs_target::attach): Update.
* nto-procfs.c (nto_procfs_target::attach): Update.
(nto_procfs_target::create_inferior): Update.
* inf-ptrace.c (inf_ptrace_target::attach): Update.
* gnu-nat.c (gnu_nat_target::attach): Update.
(gnu_nat_target::detach): Update.
* darwin-nat.c (darwin_nat_target::attach): Update.
* corefile.c (get_exec_file): Constify result. Remove extraneous
return.
* bsd-kvm.c (bsd_kvm_target_open): Update.
* gdbsupport/common-inferior.h (get_exec_file): Constify result.
gdb/gdbserver/ChangeLog
2019-12-16 Tom Tromey <tromey@adacore.com>
* server.c (get_exec_file): Constify result.
Change-Id: I29c60f7313a7def0dcb290ff0c2a4c1dea4f981f
Christian Biesinger [Sun, 17 Nov 2019 05:37:06 +0000 (23:37 -0600)]
Update Gnulib to the latest git version
This patch allows us to remove a workaround in common-defs.h due to
the gnulib fix in:
https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00024.html
All of GDB's local Gnulib patches were already fixed upstream per their
descriptions, so this patch removes them all.
The problem listed here:
https://sourceware.org/ml/gdb-patches/2019-08/msg00553.html
was probably partially fixed by moving gnulib to the toplevel;
for the remainder, I am setting MAKEOVERRIDES to empty in
gnulib/Makefile.am. See also the comment there (it fixes an issue
with compilers that don't use C99/C11 by default such as GCC 4.8.5,
the default on Centos 7).
gdb/ChangeLog:
2019-12-16 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/common-defs.h: Remove workaround for a gnulib bug
(we no longer need to include time.h before pathmax.h)
gnulib/ChangeLog:
2019-12-16 Christian Biesinger <cbiesinger@google.com>
* Makefile.am: Set MAKEOVERRIDES.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* import/Makefile.am: Update.
* import/Makefile.in: Regenerate.
* import/_Noreturn.h: New file.
* import/alloca.c (i00afunc): Update.
* import/alloca.in.h (if): Update.
* import/arg-nonnull.h: Rename from import/extra/snippet/arg-nonnull.h.
* import/arpa_inet.in.h (if): Update.
* import/assure.h: Update.
* import/at-func.c: Update.
* import/basename-lgpl.c: Update.
* import/canonicalize-lgpl.c (if): Update.
* import/c++defs.h: Rename from import/extra/snippet/c++defs.h.
* import/cdefs.h: New file.
* import/chdir-long.c: Update.
* import/chdir-long.h: Update.
* import/cloexec.c: Update.
* import/cloexec.h: Update.
* import/close.c: Update.
* import/closedir.c: Update.
* import/config.charset: Remove.
* import/dirent-private.h: Update.
* import/dirent.in.h: Update.
* import/dirfd.c: Update.
* import/dirname-lgpl.c: Update.
* import/dirname.h (base_name): Update.
* import/dosname.h (if): Update.
* import/dup-safer-flag.c: New file.
* import/dup-safer.c: Update.
* import/dup.c: Update.
* import/dup2.c (if): Update.
(dup2_nothrow): Update.
(ms_windows_dup2): Update.
* import/errno.in.h (if): Update.
(elif): Update.
* import/error.c (if): Update.
(strerror_r): Update.
(program_name): Update.
(error): Update.
(error_at_line): Update.
* import/error.h: Update.
* import/exitfail.c: Update.
* import/exitfail.h: Update.
* import/extra/config.rpath: Update.
* import/extra/snippet/_Noreturn.h: Remove.
* import/extra/update-copyright: Update.
* import/fchdir.c: Update.
* import/fcntl.c (rpl_fcntl): Update.
(INCL_DOS): Update.
(if): Update.
(rpl_fcntl_DUPFD): Update.
(rpl_fcntl_DUPFD_CLOEXEC): Update.
(klibc_fcntl): Update.
(fcntl): Update.
(have_dupfd_cloexec): Update.
* import/fcntl.in.h (if): Update.
(creat): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
(O_CLOEXEC): Update.
(GNULIB_defined_O_CLOEXEC): Update.
* import/fd-hook.c: Update.
* import/fd-hook.h: Update.
* import/fd-safer-flag.c: New file.
* import/fd-safer.c: Update.
* import/fdopendir.c: Update.
* import/filename.h: Update.
* import/filenamecat-lgpl.c (longest_relative_suffix): Update.
(mfile_name_concat): Update.
* import/filenamecat.h: Update.
* import/flexmember.h: Update.
* import/float+.h: Update.
* import/float.c: Update.
* import/float.in.h (LDBL_MIN): Update.
* import/fnmatch.c (__builtin_expect): Update.
(FALLTHROUGH): Update.
* import/fnmatch.in.h (_FNMATCH_H): Update.
(_): Update.
(fnmatch): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/fnmatch_loop.c (FCT): Update.
(EXT): Update.
* import/fpucw.h (GET_FPUCW): Update.
(SET_FPUCW): Update.
* import/frexp.c: Update.
* import/frexpl.c: Update.
* import/fstat.c (stat): Update.
(fstat): Update.
(WINDOWS_NATIVE): Update.
(fstat_nothrow): Update.
(WIN32_LEAN_AND_MEAN): Update.
* import/fstatat.c (normal_fstatat): Update.
(rpl_fstatat): Update.
* import/getcwd-lgpl.c (rpl_getcwd): Update.
* import/getcwd.c (getcwd_nothrow): Update.
(getcwd_system): Update.
(__getcwd): Update.
* import/getdtablesize.c (if): Update.
(_setmaxstdio): Update.
(_setmaxstdio_nothrow): Update.
(getdtablesize): Update.
* import/getlogin_r.c (if): Update.
(getlogin_r): Update.
* import/getprogname.c (getprogname): Update.
* import/getprogname.h: Update.
* import/gettext.h (if): Update.
* import/gettimeofday.c (WINDOWS_NATIVE): Update.
(localtime): Update.
(GetProcAddress): Update.
(gmtime): Update.
(void): Update.
(struct tm): Update.
(rpl_localtime): Update.
(initialize): Update.
(rpl_gmtime): Update.
(tzset): Update.
(rpl_tzset): Update.
* import/glob-libc.h (_Restrict_): Update.
(__size_t): Update.
(__need_size_t): Update.
(glob): Update.
(globfree): Update.
(__REDIRECT_NTH): Update.
(glob64): Update.
(globfree64): Update.
(glob_pattern_p): Update.
* import/glob.c (POSIX): Update.
(if): Update.
(__set_errno): Update.
(getpwnam_r): Update.
(__lstat64): Update.
(FLEXIBLE_ARRAY_MEMBER): Update.
(__glob_pattern_p): Update.
(GETPW_R_SIZE_MAX): Update.
(GET_LOGIN_NAME_MAX): Update.
(DT_UNKNOWN): Update.
(DT_DIR): Update.
(DT_LNK): Update.
(D_TYPE_TO_RESULT): Update.
(readdir_result_might_be_symlink): Update.
(readdir_result_might_be_dir): Update.
(readdir_result_type): Update.
(D_INO_TO_RESULT): Update.
(READDIR_RESULT_INITIALIZER): Update.
(attribute_hidden): Update.
(__attribute_noinline__): Update.
(__builtin_expect): Update.
(__glibc_unlikely): Update.
(__has_builtin): Update.
(__glob_pattern_type): Update.
(is_dir): Update.
(glob): Update.
(globfree): Update.
(libc_hidden_def): Update.
(DIRSEP_CHAR): Update.
(prefix_array): Update.
(weak_alias): Update.
(link_exists2_p): Update.
(link_exists_p): Update.
(glob_in_dir): Update.
(GLOBNAMES_MEMBERS): Update.
* import/glob.in.h (_GL_GLOB_H): Update.
(_): Update.
(__BEGIN_DECLS): Update.
(__END_DECLS): Update.
(_Restrict_): Update.
(__THROW): Update.
(__THROWNL): Update.
(__size_t): Update.
(__USE_GNU): Update.
(glob): Update.
(globfree): Update.
(glob_pattern_p): Update.
(__glob_pattern_p): Update.
(__GLOB_GNULIB): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_WARN_ON_USE): Update.
* import/glob_internal.h: New file.
* import/glob_pattern_p.c: New file.
* import/globfree.c: New file.
* import/glthread/lock.c (glthread_rwlock_init_for_glibc): Update.
(glthread_rwlock_rdlock_multithreaded): Update.
(glthread_once_call): Update.
(glthread_once_multithreaded): Update.
(glthread_once_singlethreaded): Update.
(glthread_recursive_lock_init_multithreaded): Update.
(glthread_recursive_lock_lock_multithreaded): Update.
(glthread_recursive_lock_unlock_multithreaded): Update.
(glthread_recursive_lock_destroy_multithreaded): Update.
(glthread_lock_init_func): Update.
(glthread_lock_lock_func): Update.
(glthread_lock_unlock_func): Update.
(glthread_lock_destroy_func): Update.
(gl_waitqueue_t): Update.
(gl_waitqueue_init): Update.
(gl_waitqueue_add): Update.
(gl_waitqueue_notify_first): Update.
(gl_waitqueue_notify_all): Update.
(glthread_rwlock_init_func): Update.
(glthread_rwlock_rdlock_func): Update.
(glthread_rwlock_wrlock_func): Update.
(glthread_rwlock_unlock_func): Update.
(glthread_rwlock_destroy_func): Update.
(glthread_recursive_lock_init_func): Update.
(glthread_recursive_lock_lock_func): Update.
(glthread_recursive_lock_unlock_func): Update.
(glthread_recursive_lock_destroy_func): Update.
(glthread_once_func): Update.
* import/glthread/lock.h (c11_threads_in_use): Update.
(pthread_in_use): Update.
(gl_rwlock_initializer): Update.
(glthread_rwlock_init): Update.
(glthread_rwlock_init_for_glibc): Update.
(pth_in_use): Update.
(gl_lock_define): Update.
(gl_lock_define_initialized): Update.
(gl_lock_initializer): Update.
(glthread_lock_init): Update.
(glthread_lock_lock): Update.
(glthread_lock_unlock): Update.
(glthread_lock_destroy): Update.
(gl_rwlock_define): Update.
(gl_rwlock_define_initialized): Update.
(glthread_rwlock_rdlock): Update.
(glthread_rwlock_wrlock): Update.
(glthread_rwlock_unlock): Update.
(glthread_rwlock_destroy): Update.
(gl_recursive_lock_define): Update.
(gl_recursive_lock_define_initialized): Update.
(gl_recursive_lock_initializer): Update.
(glthread_recursive_lock_init): Update.
(glthread_recursive_lock_lock): Update.
(glthread_recursive_lock_unlock): Update.
(glthread_recursive_lock_destroy): Update.
(gl_once_define): Update.
(glthread_once): Update.
(glthread_once_multithreaded): Update.
(glthread_once_singlethreaded): Update.
(thread_in_use): Update.
(glthread_recursive_lock_init_multithreaded): Update.
(glthread_recursive_lock_lock_multithreaded): Update.
(glthread_recursive_lock_unlock_multithreaded): Update.
(glthread_recursive_lock_destroy_multithreaded): Update.
(glthread_lock_init_func): Update.
(glthread_lock_lock_func): Update.
(glthread_lock_unlock_func): Update.
(glthread_lock_destroy_func): Update.
(glthread_rwlock_init_func): Update.
(glthread_rwlock_rdlock_func): Update.
(glthread_rwlock_wrlock_func): Update.
(glthread_rwlock_unlock_func): Update.
(glthread_rwlock_destroy_func): Update.
(glthread_recursive_lock_init_func): Update.
(glthread_recursive_lock_lock_func): Update.
(glthread_recursive_lock_unlock_func): Update.
(glthread_recursive_lock_destroy_func): Update.
(glthread_once_func): Update.
* import/glthread/threadlib.c: Update.
* import/hard-locale.c: Update.
* import/hard-locale.h: Update.
* import/inet_ntop.c: Update.
* import/intprops.h (__has_builtin): Update.
(_GL_INT_CONVERT): Update.
(_GL_INT_NEGATE_CONVERT): Update.
(verify): Update.
(_GL_HAS_BUILTIN_OVERFLOW): Update.
(_GL_HAS_BUILTIN_ADD_OVERFLOW): Update.
(_GL_HAS_BUILTIN_OVERFLOW_P): Update.
(_GL_HAS_BUILTIN_MUL_OVERFLOW): Update.
(_GL_BINARY_OP_OVERFLOW): Update.
(INT_ADD_WRAPV): Update.
(INT_SUBTRACT_WRAPV): Update.
(INT_MULTIPLY_WRAPV): Update.
(_GL_INT_OP_WRAPV): Update.
(_GL_INT_OP_WRAPV_SMALLISH): Update.
(_GL_INT_OP_WRAPV_LONGISH): Update.
(_GL_INT_OP_CALC): Update.
(_GL_INT_OP_CALC1): Update.
(_GL_INT_OP_WRAPV_VIA_UNSIGNED): Update.
(_GL_INT_ADD_RANGE_OVERFLOW): Update.
(_GL_INT_SUBTRACT_RANGE_OVERFLOW): Update.
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): Update.
* import/inttypes.in.h (if): Update.
* import/isnan.c: Update.
* import/isnand-nolibm.h: Update.
* import/isnand.c: Update.
* import/isnanl-nolibm.h: Update.
* import/isnanl.c: Update.
* import/itold.c: Update.
* import/libc-config.h: New file.
* import/limits.in.h (LLONG_MIN): Update.
(LLONG_MAX): Update.
(ULLONG_MAX): Update.
(WORD_BIT): Update.
(LONG_BIT): Update.
* import/localcharset.c (setlocale): Update.
(relocate): Update.
(O_NOFOLLOW): Update.
(ISSLASH): Update.
(DIRECTORY_SEPARATOR): Update.
(getc): Update.
(volatile): Update.
(get_charset_aliases): Update.
(struct table_entry): Update.
(alias_table_defined): Update.
(locale_table_defined): Update.
(locale_charset): Update.
(if): Update.
* import/localcharset.h: Update.
* import/localtime-buffer.c: New file.
* import/localtime-buffer.h: New file.
* import/lstat.c (rpl_lstat): Update.
* import/m4/00gnulib.m4: Update.
* import/m4/__inline.m4: New file.
* import/m4/absolute-header.m4: Update.
* import/m4/alloca.m4: Update.
* import/m4/arpa_inet_h.m4: Update.
* import/m4/builtin-expect.m4: New file.
* import/m4/canonicalize.m4: Update.
* import/m4/chdir-long.m4: Update.
* import/m4/close.m4: Update.
* import/m4/closedir.m4: Update.
* import/m4/codeset.m4: Update.
* import/m4/configmake.m4: Remove.
* import/m4/d-ino.m4: Update.
* import/m4/d-type.m4: Update.
* import/m4/dirent_h.m4: Update.
* import/m4/dirfd.m4: Update.
* import/m4/dirname.m4: Update.
* import/m4/double-slash-root.m4: Update.
* import/m4/dup.m4: Update.
* import/m4/dup2.m4: Update.
* import/m4/eealloc.m4: Update.
* import/m4/environ.m4: Update.
* import/m4/errno_h.m4: Update.
* import/m4/error.m4: Update.
* import/m4/exponentd.m4: Update.
* import/m4/exponentl.m4: Update.
* import/m4/extensions.m4: Update.
* import/m4/extern-inline.m4: Update.
* import/m4/fchdir.m4: Update.
* import/m4/fcntl-o.m4: Update.
* import/m4/fcntl.m4: Update.
* import/m4/fcntl_h.m4: Update.
* import/m4/fdopendir.m4: Update.
* import/m4/filenamecat.m4: Update.
* import/m4/flexmember.m4: Update.
* import/m4/float_h.m4: Update.
* import/m4/fnmatch.m4: Update.
* import/m4/fnmatch_h.m4: New file.
* import/m4/fpieee.m4: Update.
* import/m4/frexp.m4: Update.
* import/m4/frexpl.m4: Update.
* import/m4/fstat.m4: Update.
* import/m4/fstatat.m4: Update.
* import/m4/getcwd-abort-bug.m4: Update.
* import/m4/getcwd-path-max.m4: Update.
* import/m4/getcwd.m4: Update.
* import/m4/getdtablesize.m4: Update.
* import/m4/getlogin.m4: New file.
* import/m4/getlogin_r.m4: Update.
* import/m4/getpagesize.m4: New file.
* import/m4/getprogname.m4: Update.
* import/m4/gettimeofday.m4: Update.
* import/m4/glibc21.m4: Remove.
* import/m4/glob.m4: Update.
* import/m4/glob_h.m4: New file.
* import/m4/gnulib-cache.m4: Update.
* import/m4/gnulib-common.m4: Update.
* import/m4/gnulib-comp.m4: Update.
* import/m4/gnulib-tool.m4: Update.
* import/m4/hard-locale.m4: Remove.
* import/m4/host-cpu-c-abi.m4: New file.
* import/m4/include_next.m4: Update.
* import/m4/inet_ntop.m4: Update.
* import/m4/inttypes-pri.m4: Update.
* import/m4/inttypes.m4: Update.
* import/m4/isnand.m4: Update.
* import/m4/isnanl.m4: Update.
* import/m4/largefile.m4: Update.
* import/m4/lib-ld.m4: Update.
* import/m4/lib-link.m4: Update.
* import/m4/lib-prefix.m4: Update.
* import/m4/limits-h.m4: Update.
* import/m4/localcharset.m4: Update.
* import/m4/locale-fr.m4: Update.
* import/m4/locale-ja.m4: Update.
* import/m4/locale-zh.m4: Update.
* import/m4/localtime-buffer.m4: New file.
* import/m4/lock.m4: Update.
* import/m4/longlong.m4: Update.
* import/m4/lstat.m4: Update.
* import/m4/malloc.m4: Update.
* import/m4/malloca.m4: Update.
* import/m4/math_h.m4: Update.
* import/m4/mbrtowc.m4: Update.
* import/m4/mbsinit.m4: Update.
* import/m4/mbsrtowcs.m4: Update.
* import/m4/mbstate_t.m4: Update.
* import/m4/memchr.m4: Update.
* import/m4/memmem.m4: Update.
* import/m4/mempcpy.m4: Update.
* import/m4/memrchr.m4: Update.
* import/m4/mkdir.m4: Update.
* import/m4/mkdtemp.m4: Update.
* import/m4/mkostemp.m4: Update.
* import/m4/mmap-anon.m4: Update.
* import/m4/mode_t.m4: Update.
* import/m4/msvc-inval.m4: Update.
* import/m4/msvc-nothrow.m4: Update.
* import/m4/multiarch.m4: Update.
* import/m4/netinet_in_h.m4: Update.
* import/m4/nocrash.m4: Update.
* import/m4/off_t.m4: Update.
* import/m4/onceonly.m4: Remove.
* import/m4/open-cloexec.m4: New file.
* import/m4/open-slash.m4: New file.
* import/m4/open.m4: Update.
* import/m4/openat.m4: Update.
* import/m4/opendir.m4: Update.
* import/m4/pathmax.m4: Update.
* import/m4/pthread_rwlock_rdlock.m4: New file.
* import/m4/rawmemchr.m4: Update.
* import/m4/readdir.m4: Update.
* import/m4/readlink.m4: Update.
* import/m4/realloc.m4: Update.
* import/m4/rename.m4: Update.
* import/m4/rewinddir.m4: Update.
* import/m4/rmdir.m4: Update.
* import/m4/save-cwd.m4: Update.
* import/m4/secure_getenv.m4: Remove.
* import/m4/setenv.m4: Update.
* import/m4/signal_h.m4: Update.
* import/m4/socklen.m4: Update.
* import/m4/sockpfaf.m4: Update.
* import/m4/ssize_t.m4: Update.
* import/m4/stat-time.m4: New file.
* import/m4/stat.m4: Update.
* import/m4/std-gnu11.m4: New file.
* import/m4/stdalign.m4: Update.
* import/m4/stdbool.m4: Update.
* import/m4/stddef_h.m4: Update.
* import/m4/stdint.m4: Update.
* import/m4/stdio_h.m4: Update.
* import/m4/stdlib_h.m4: Update.
* import/m4/strchrnul.m4: Update.
* import/m4/strdup.m4: Update.
* import/m4/strerror.m4: Update.
* import/m4/strerror_r.m4: Update.
* import/m4/string_h.m4: Update.
* import/m4/strstr.m4: Update.
* import/m4/strtok_r.m4: Update.
* import/m4/sys_socket_h.m4: Update.
* import/m4/sys_stat_h.m4: Update.
* import/m4/sys_time_h.m4: Update.
* import/m4/sys_types_h.m4: Update.
* import/m4/sys_uio_h.m4: Update.
* import/m4/tempname.m4: Update.
* import/m4/threadlib.m4: Update.
* import/m4/time_h.m4: Update.
* import/m4/time_r.m4: Update.
* import/m4/unistd-safer.m4: Update.
* import/m4/unistd_h.m4: Update.
* import/m4/warn-on-use.m4: Update.
* import/m4/wchar_h.m4: Update.
* import/m4/wchar_t.m4: Update.
* import/m4/wctype_h.m4: Update.
* import/m4/wint_t.m4: Update.
* import/malloc.c: Update.
* import/malloc/scratch_buffer.h: New file.
* import/malloc/scratch_buffer_grow.c: New file.
* import/malloc/scratch_buffer_grow_preserve.c: New file.
* import/malloc/scratch_buffer_set_array_size.c: New file.
* import/malloca.c (MAGIC_NUMBER): Update.
(MAGIC_SIZE): Update.
(struct preliminary_header): Update.
(HEADER_SIZE): Update.
(union header): Update.
(verify): Update.
(HASH_TABLE_SIZE): Update.
(freea): Update.
* import/malloca.h (malloca): Update.
(nmalloca): Update.
* import/malloca.valgrind: Remove.
* import/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Update.
(func): Update.
(rpl_func): Update.
(f): Update.
(d): Update.
(l): Update.
(_GL_WARN_ON_USE): Update.
(_GL_WARN_ON_USE_ATTRIBUTE): Update.
(FP_ILOGB0): Update.
(FP_ILOGBNAN): Update.
(acosf): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(asinf): Update.
(atanf): Update.
(atan2f): Update.
(cosf): Update.
(coshf): Update.
(expf): Update.
(expl): Update.
(expm1l): Update.
(ilogbl): Update.
(rintl): Update.
(sinf): Update.
(sinhf): Update.
(sqrtf): Update.
(tanf): Update.
(tanhf): Update.
(isfinite): Update.
(isinf): Update.
(isnan): Update.
(GNULIB_defined_signbit): Update.
(signbit): Update.
* import/mbrtowc.c (FALLTHROUGH): Update.
(locale_enc): Update.
(locale_enc_cached): Update.
(gl_lock_define_initialized): Update.
(mbrtowc): Update.
* import/mbsinit.c (if): Update.
(mbsinit): Update.
* import/mbsrtowcs-impl.h: Update.
* import/mbsrtowcs-state.c: Update.
* import/mbsrtowcs.c: Update.
* import/memchr.c: Update.
* import/memchr.valgrind: Update.
* import/memmem.c (__builtin_expect): Update.
* import/mempcpy.c: Update.
* import/memrchr.c (__memrchr): Update.
* import/mkdir.c (if): Update.
* import/mkdtemp.c: Update.
* import/mkostemp.c: Update.
* import/msvc-inval.c: Update.
* import/msvc-inval.h: Update.
* import/msvc-nothrow.c: Update.
* import/msvc-nothrow.h (if): Update.
* import/netinet_in.in.h: Update.
* import/open.c (open): Update.
(if): Update.
* import/openat-die.c: Update.
* import/openat-priv.h: Update.
* import/openat-proc.c: Update.
* import/openat.c (rpl_openat): Update.
* import/openat.h: Update.
* import/opendir.c: Update.
* import/pathmax.h (if): Update.
* import/pipe-safer.c: Update.
* import/rawmemchr.c: Update.
* import/rawmemchr.valgrind: Update.
* import/readdir.c (readdir): Update.
* import/readlink.c: Update.
* import/realloc.c: Update.
* import/ref-add.sin: Remove.
* import/ref-del.sin: Remove.
* import/rename.c (if): Update.
* import/rewinddir.c: Update.
* import/rmdir.c: Update.
* import/same-inode.h (SAME_INODE): Update.
* import/save-cwd.c (save_cwd): Update.
* import/save-cwd.h: Update.
* import/scratch_buffer.h: New file.
* import/secure_getenv.c: Remove.
* import/setenv.c: Update.
* import/signal.in.h: Update.
* import/stat-time.c: New file.
* import/stat-time.h: New file.
* import/stat-w32.c: New file.
* import/stat-w32.h: New file.
* import/stat.c (if): Update.
(stat): Update.
(REPLACE_FUNC_STAT_DIR): Update.
(WINDOWS_NATIVE): Update.
(WIN32_LEAN_AND_MEAN): Update.
(is_unc_root): Update.
(rpl_stat): Update.
* import/stdalign.in.h (elif): Update.
* import/stdbool.in.h: Update.
* import/stddef.in.h (_GL_STDDEF_ALIGNAS): Update.
(max_align_t): Update.
(GNULIB_defined_max_align_t): Update.
* import/stdint.in.h (WINT_MIN): Update.
(WINT_MAX): Update.
(_STDINT_MIN): Update.
(_STDINT_UNSIGNED_MIN): Update.
(_STDINT_SIGNED_MIN): Update.
(PTRDIFF_MIN): Update.
(SIG_ATOMIC_MIN): Update.
(WCHAR_MIN): Update.
* import/stdio.in.h (if): Update.
* import/stdlib.in.h (if): Update.
(_GL_WARN_ON_USE): Update.
(_GL_FUNCDECL_SYS): Update.
(random): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(srandom): Update.
(initstate): Update.
(setstate): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(GNULIB_defined_strtod_function): Update.
(strtold): Update.
(GNULIB_defined_strtold_function): Update.
* import/str-two-way.h: Update.
* import/strchrnul.c: Update.
* import/strchrnul.valgrind: Update.
* import/strdup.c: Update.
* import/streq.h: Update.
* import/strerror-override.c: Update.
* import/strerror-override.h: Update.
* import/strerror.c (strerror): Update.
* import/strerror_r.c (safe_copy): Update.
* import/string.in.h (_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/stripslash.c: Update.
* import/strnlen1.c: Update.
* import/strnlen1.h: Update.
* import/strstr.c (__builtin_expect): Update.
* import/strtok_r.c: Update.
* import/sys_socket.in.h (CMSG_SPACE): Update.
(CMSG_LEN): Update.
(struct sockaddr_storage): Update.
(SO_REUSEPORT): Update.
(_GL_WARN_ON_USE): Update.
* import/sys_stat.in.h (if): Update.
(stat): Update.
(struct stat): Update.
(st_atime): Update.
(st_mtime): Update.
(st_ctime): Update.
(_GL_WINDOWS_STAT_TIMESPEC): Update.
(GNULIB_defined_struct_stat): Update.
(_S_IFBLK): Update.
(_S_IFLNK): Update.
(_S_IFSOCK): Update.
(fstat): Update.
(fstatat): Update.
(lstat): Update.
(stat64): Update.
(_stat64): Update.
(_stat32i64): Update.
(_stati64): Update.
(_stat32): Update.
(_stat64i32): Update.
* import/sys_time.in.h: Update.
* import/sys_types.in.h (dev_t): Update.
(GNULIB_defined_dev_t): Update.
(ino_t): Update.
(GNULIB_defined_ino_t): Update.
(_GL_WINDOWS_STAT_INODES): Update.
(if): Update.
* import/sys_uio.in.h: Update.
* import/tempname.c (__secure_getenv): Update.
(try_nocreate): Update.
* import/tempname.h: Update.
* import/time.in.h (tzset): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(ctime): Update.
(strftime): Update.
* import/time_r.c: Update.
* import/unistd--.h: Update.
* import/unistd-safer.h: Update.
* import/unistd.in.h (if): Update.
(elif): Update.
(__need_getopt): Update.
(access): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
(_GL_FUNCDECL_SYS): Update.
(__declspec): Update.
(_GL_WARN_ON_USE_ATTRIBUTE): Update.
(faccessat): Update.
(getpass): Update.
(truncate): Update.
* import/unsetenv.c: Update.
* import/verify.h (if): Update.
(_GL_HAVE__STATIC_ASSERT): Update.
(_GL_HAVE_STATIC_ASSERT): Update.
(_GL_HAVE__STATIC_ASSERT1): Update.
(_GL_HAVE_STATIC_ASSERT1): Update.
(_GL_VERIFY): Update.
(_Static_assert): Update.
(_GL_HAS_BUILTIN_TRAP): Update.
(_GL_HAS_BUILTIN_UNREACHABLE): Update.
(verify_true): Update.
(verify): Update.
(__has_builtin): Update.
(elif): Update.
(assume): Update.
* import/warn-on-use.h: Rename from import/extra/snippet/warn-on-use.h.
* import/wchar.in.h (if): Update.
(wcsftime): Update.
(_GL_FUNCDECL_RPL): Update.
(_GL_CXXALIAS_RPL): Update.
(_GL_FUNCDECL_SYS): Update.
(_GL_CXXALIAS_SYS): Update.
(_GL_CXXALIASWARN): Update.
(_GL_WARN_ON_USE): Update.
* import/wctype.in.h (rpl_iswalnum): Update.
(rpl_iswalpha): Update.
(rpl_iswblank): Update.
(rpl_iswcntrl): Update.
(rpl_iswdigit): Update.
(rpl_iswgraph): Update.
(rpl_iswlower): Update.
(rpl_iswprint): Update.
(rpl_iswpunct): Update.
(rpl_iswspace): Update.
(rpl_iswupper): Update.
(rpl_iswxdigit): Update.
(rpl_towlower): Update.
(rpl_towupper): Update.
(iswalnum): Update.
(iswalpha): Update.
(iswblank): Update.
(iswcntrl): Update.
(iswdigit): Update.
(iswgraph): Update.
(iswlower): Update.
(iswprint): Update.
(iswpunct): Update.
(iswspace): Update.
(iswupper): Update.
(iswxdigit): Update.
(towlower): Update.
(towupper): Update.
* import/windows-initguard.h: New file.
* import/windows-mutex.c: New file.
* import/windows-mutex.h: New file.
* import/windows-once.c: New file.
* import/windows-once.h: New file.
* import/windows-recmutex.c: New file.
* import/windows-recmutex.h: New file.
* import/windows-rwlock.c: New file.
* import/windows-rwlock.h: New file.
* import/xalloc-oversized.h: New file.
* patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch: Remove.
* patches/0002-mkostemp-mkostemps-Fix-compilation-error-in-C-mode-o.patch: Remove.
* patches/0003-Fix-glob-c-Coverity-issues.patch: Remove.
* update-gnulib.sh: Update to latest gnulib and don't apply patches
anymore. Also updates the patch -p flag to the current directory structure in
case patches are needed again in the future.
Change-Id: I9c2b07a3046baecfb664e21b2644353ea888dbfa
Alan Modra [Mon, 16 Dec 2019 06:28:30 +0000 (16:58 +1030)]
ubsan: aarch64: left shift of negative value
* aarch64-dis.c (sign_extend): Return uint64_t. Rewrite without
conditional.
(aarch64_ext_imm): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:29:23 +0000 (09:59 +1030)]
ubsan: microblaze: left shift cannot be represented in type 'int'
* microblaze-dis.c (read_insn_microblaze): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:28:52 +0000 (09:58 +1030)]
ubsan: nios2: left shift cannot be represented in type 'int'
* nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
Alan Modra [Sun, 15 Dec 2019 23:30:07 +0000 (10:00 +1030)]
ubsan: xstormy16: left shift of negative value
cpu/
* xstormy16.cpu (f-rel12a): Avoid signed overflow.
opcodes/
* xstormy16-ibld.c: Regenerate.
Alan Modra [Sun, 15 Dec 2019 23:30:39 +0000 (10:00 +1030)]
asan: score: global-buffer-overflow
I'm flying blind here, not having an s+core s3 insn set reference,
but this seems reasonably obvious from what is done by the assembler.
s3_do16_rpop does some mixing of imm and reg values to place in the
rpop reg field, but I'm not going to try to fix the disassembly
there.
* score-dis.c (print_insn_score16): Move rpush/rpop imm field
value adjustment so that it doesn't affect reg field too.
Alan Modra [Sun, 15 Dec 2019 23:28:09 +0000 (09:58 +1030)]
ubsan: crx: left shift cannot be represented in type 'int'
The ubsan complaint is fixed by the SBM change, with similar possible
complaints fixed by the EXTRACT change. The rest is just cleanup.
include/
* opcode/crx.h (inst <match>): Make unsigned int.
opcodes/
* crx-dis.c (EXTRACT, SBM): Avoid signed overflow.
(get_number_of_operands, getargtype, getbits, getregname),
(getcopregname, getprocregname, gettrapstring, getcinvstring),
(getregliststring, get_word_at_PC, get_words_at_PC, build_mask),
(powerof2, match_opcode, make_instruction, print_arguments),
(print_arg): Delete forward declarations, moving static to..
(getregname, getcopregname, getregliststring): ..these definitions.
(build_mask): Return unsigned int mask.
(match_opcode): Use unsigned int vars.
Alan Modra [Mon, 16 Dec 2019 00:01:34 +0000 (10:31 +1030)]
ubsan: bfin: left shift of negative value
* bfin-dis.c (fmtconst, fmtconst_val): Avoid signed overflow.
Alan Modra [Sun, 15 Dec 2019 23:05:30 +0000 (09:35 +1030)]
ubsan: nds32: left shift cannot be represented in type 'int'
Note that using 1u in N32_BIT makes all of N32_BIT, __MASK, __MF, __GF
and __SEXT evaluate as unsigned int (the latter three when when their
v arg is int or smaller). This would be a problem if assigning the
result to a bfd_vma, long, or other type wider than an int since the
__SEXT result would be zero extended to the wider type. Fortunately
nds32 target code doesn't use wider types unnecessarily.
include/
* opcode/nds32.h (N32_BIT): Define using 1u.
(__SEXT): Use __MASK and N32_BIT.
(N32_IMMS): Remove duplicate mask.
opcodes/
* nds32-dis.c (print_insn16, print_insn32): Remove forward decls.
(struct objdump_disasm_info): Delete.
(nds32_parse_audio_ext, nds32_parse_opcode): Cast result of
N32_IMMS to unsigned before shifting left.
Alan Modra [Sun, 15 Dec 2019 23:27:22 +0000 (09:57 +1030)]
ubsan: moxie: left shift of negative value
Commit
8c9b4171877df didn't remove a glaring left shift of a number
that had just been sign extended.
* moxie-dis.c (INST2OFFSET): Don't left shift a signed value.
(print_insn_moxie): Remove unnecessary cast.
Christian Biesinger [Thu, 12 Dec 2019 00:50:43 +0000 (19:50 -0500)]
Use a member function to set a symbol's language
This removes symbol_set_language and SYMBOL_SET_LANGUAGE in favor of
a new function general_symbol_info::set_language. symbol and minimal_symbol
already inherit from that struct so this works naturally.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-exp.y (write_ambiguous_var): Update.
* coffread.c (process_coff_symbol): Update.
* ctfread.c (ctf_add_enum_member_cb): Update.
(new_symbol): Update.
* dwarf2read.c (fixup_go_packaging): Update.
(new_symbol): Update.
* language.c (language_alloc_type_symbol): Update.
* mdebugread.c (new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Update.
* psymtab.c (add_psymbol_to_bcache): Update.
* stabsread.c (define_symbol): Update.
(read_enum_type): Update.
* symtab.c (symbol_set_language): Make this a member function...
(general_symbol_info::set_language): ... here.
* symtab.h (struct general_symbol_info) <set_language>: New function.
(SYMBOL_SET_LANGUAGE): Remove.
(symbol_set_language): Remove.
Change-Id: Ideafb6c384004b9adef793a1192735c501da41d5
Christian Biesinger [Tue, 3 Dec 2019 23:10:32 +0000 (17:10 -0600)]
Use an accessor function for general_symbol_info::language
Also renames the member variable to m_language to make code easier to read
when more functions become member functions.
I was originally hoping to eventually make m_language private (after a few
more patches), but unfortunately then it no longer counts as a POD type,
which means gdbsupport/poison.h won't let us use memset to initialize
this type, which psymtabs rely on to clear padding bytes so that bcache
can work properly.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_add_block_symbols): Update.
(ada_collect_symbol_completion_matches): Update.
* ax-gdb.c (gen_expr): Update.
* block.c (block_lookup_symbol): Update.
(block_lookup_symbol_primary): Update.
(block_find_symbol): Update.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Update.
* dbxread.c (process_one_symbol): Update.
* dictionary.c (insert_symbol_hashed): Update.
(collate_pending_symbols_by_language): Update.
(mdict_add_symbol): Update.
* dwarf-index-write.c (write_psymbols): Update.
* dwarf2read.c (fixup_go_packaging): Update.
* findvar.c (read_var_value): Update.
* ft32-tdep.c (ft32_skip_prologue): Update.
* go-lang.c (go_symbol_package_name): Update.
* language.h (scoped_switch_to_sym_language_if_auto::
scoped_switch_to_sym_language_if_auto): Update.
* linespec.c (find_method): Update.
(find_label_symbols_in_block): Update.
* mdebugread.c (parse_symbol): Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* minsyms.c (add_minsym_to_demangled_hash_table): Update.
(minimal_symbol_reader::install): Update.
* moxie-tdep.c (moxie_skip_prologue): Update.
* parse.c (parse_exp_in_context): Update.
* psymtab.c (psymbol_name_matches): Update.
(match_partial_symbol): Update.
(lookup_partial_symbol): Update.
(psymbol_hash): Update.
(psymbol_compare): Update.
* python/py-framefilter.c (extract_sym): Update.
(py_print_single_arg): Update.
* stabsread.c (define_symbol): Update.
* stack.c (print_frame_arg): Update.
(find_frame_funname): Update.
(info_frame_command_core): Update.
* symfile.c (set_initial_language): Update.
* symtab.c (symbol_set_demangled_name): Update.
(symbol_get_demangled_name): Update.
(symbol_set_language): Update.
(symbol_find_demangled_name): Update.
(symbol_set_names): Update.
(general_symbol_info::natural_name): Update.
(general_symbol_info::demangled_name): Update.
(general_symbol_info::search_name): Update.
(symbol_matches_search_name): Update.
(eq_symbol_entry): Update.
(iterate_over_symbols): Update.
(completion_list_add_symbol): Update.
(completion_list_add_msymbol): Update.
(completion_list_add_fields): Update.
* symtab.h (struct general_symbol_info) <language>: New function.
<language>: Rename to...
<m_language>: ...this.
(SYMBOL_LANGUAGE): Remove.
(MSYMBOL_LANGUAGE): Remove.
(struct symbol) <ctor>: Update.
* xstormy16-tdep.c (xstormy16_skip_prologue): Update.
Change-Id: I6464d477457e61639c63ddf8b145e407a35c235a
Christian Biesinger [Sat, 14 Dec 2019 20:47:22 +0000 (15:47 -0500)]
Use symbol_set_language to set a symbol's language
Instead of using SYMBOL_LANGUAGE (sym) = foo.
Having only a single way to set a symbol's language is clearer and this
is also a requirement for making set_language a member function.
gdb/ChangeLog:
2019-12-15 Christian Biesinger <cbiesinger@google.com>
* ada-exp.y (write_ambiguous_var): Call symbol_set_language to
set the language of sym.
* language.c (language_alloc_type_symbol): Likewise.
Change-Id: I85338ea2e4121155f2da222fe0aa6b7d3ffe26f7
GDB Administrator [Mon, 16 Dec 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 15 Dec 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Sat, 14 Dec 2019 23:11:58 +0000 (23:11 +0000)]
gdb/doc: Remove duplicate description of lookup_global_symbol
In this commit:
commit
086baaf1346f07acfb6708e8c6cb79274241488b
Date: Tue Oct 15 16:18:26 2019 +0100
gdb/python: Introduce gdb.lookup_static_symbols
A duplicate description of gdb.lookup_global_symbol was accidentally
added. This commit corrects this mistake and removes the duplicate.
gdb/doc/ChangeLog:
* python.texi (Symbols In Python): Remove duplicate description of
gdb.lookup_global_symbol.
Change-Id: I4457b42cf05bde39e5c0ff39f168af919cad1255
Anthony Green [Sat, 14 Dec 2019 10:23:20 +0000 (05:23 -0500)]
Add unlink support to moxie simulator
This change adds support for the unlink system call, which is
required by the GCC testsuite. It also switches read/write/open
system calls to use the sim_io_* functions.
2019-12-14 Anthony Green <green@moxielogic.com>
* interp.c (sim_engine_run): Make use of sim_io_* functions for
read/write/open system calls. Implement the unlink system call.
Sergio Durigan Junior [Wed, 10 Jul 2019 20:18:27 +0000 (16:18 -0400)]
Guard against 'current_directory == NULL' on gdb_abspath (PR gdb/23613)
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=
1728147
Ref.: https://sourceware.org/bugzilla/show_bug.cgi?id=23613
Hi,
This bug has been reported against Fedora GDB, but there's also an
upstream bug. The problem reported is that GDB segfaults when the
working directory is deleted. It's pretty use to reproduce it:
mkdir bla
cd bla
rmdir ../bla
gdb echo
Debugging the problem is a bit tricky, because, since the current
directory doesn't exist anymore, a corefile cannot be saved there.
After a few attempts, I came up with the following:
gdb -ex 'shell mkdir bla' -ex 'cd bla' -ex 'shell rmdir ../bla' -ex 'r echo' ./gdb/gdb
This assumes that you're inside a build directory which contains
./gdb/gdb, of course.
After investigating it, I found that the problem happens at
gdb_abspath, where we're dereferencing 'current_directory' without
checking if it's NULL:
...
(concat (current_directory,
IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
? "" : SLASH_STRING,
...
So I fixed the problem with the patch below. The idea is that, if
'current_directory' is NULL, then the final string returned should be
just the "path".
After fixing the bug, I found a similar one reported against our
bugzilla: PR gdb/23613. The problem is the same, but the reproducer
is a bit different.
I really tried writing a testcase for this, but unfortunately it's
apparently not possible to start GDB inside a non-existent directory
with DejaGNU.
I regression tested this patch on the BuildBot, and no regressions
were found.
gdb/ChangeLog:
2019-12-14 Sergio Durigan Junior <sergiodj@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=
1728147
PR gdb/23613
* bsd-kvm.c (bsd_kvm_target_open): Use 'gdb_abspath'.
* corelow.c: Include 'gdbsupport/pathstuff.h'.
(core_target_open): Use 'gdb_abspath'.
* gdbsupport/pathstuff.c (gdb_abspath): Guard against
'current_directory == NULL' case.
* gdbsupport/pathstuff.h (gdb_abspath): Expand comment and
explain what happens when 'current_directory' is NULL.
* go32-nat.c (go32_nat_target::wait): Check if
'current_directory' is NULL before call to 'chdir'.
* source.c (add_path): Use 'gdb_abspath'.
* top.c: Include 'gdbsupport/pathstuff.h'.
(init_history): Use 'gdb_abspath'.
(set_history_filename): Likewise.
* tracefile-tfile.c: Include 'gdbsupport/pathstuff.h'.
(tfile_target_open): Use 'gdb_abspath'.
Change-Id: Ibb0932fa25bc5c2d3ae4a7f64bd7f32885ca403b
GDB Administrator [Sat, 14 Dec 2019 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 13 Dec 2019 22:35:05 +0000 (17:35 -0500)]
Revert "Turn off threaded minsym demangling by default"
This reverts commit
62e77f56f0ce8b10122881d8f0acd70e113fde93.
(except for ChangeLog and a bugfix in minimal_symbol_reader::install)
As agreed on the mailing list, now that GDB 9 has branched, this patch
reverts the change to set worker-threads to zero. After this patch,
multithreaded minsym demangling will be enabled again by default.
gdb/ChangeLog:
2019-12-13 Christian Biesinger <cbiesinger@google.com>
* maint.c (n_worker_threads): Default to -1.
(worker_threads_disabled): Remove function.
* maint.h (worker_threads_disabled): Remove function.
* minsyms.c (minimal_symbol_reader::record_full): Don't call
symbol_set_names here if worker_threads_disabled () is true.
Change-Id: I5ff3e318d96f60968c8b8bedb84546ad2314d94b
Tom Tromey [Thu, 12 Dec 2019 17:40:08 +0000 (10:40 -0700)]
Remove ARI check for multiple calls to warning or error
ARI has a check for multiple calls to warning or error, suggesting
that they be combined into a single call. This triggers at three
places in gdb -- throw_bad_regnum_error, guile_repl_command, and the
end of value_cast -- and after examining these, I think they all make
sense as-is. Instead, it makes sense to remove this check from ARI.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove check for multiple calls to
warning or error.
Change-Id: I0618683623a3c7324460c7b9e5d7f252d88c2e8d
Tom Tromey [Thu, 12 Dec 2019 16:10:49 +0000 (09:10 -0700)]
Remove "fix" call for "long long" from ARI
ARI has a "fix" call for "long long", but this call is incorrect.
This patch removes it.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove call to "fix" for "long long".
Change-Id: I97bca2dc04b579fcf7c9dba7fe7fd939451bcefa
Tom Tromey [Thu, 5 Dec 2019 15:36:31 +0000 (08:36 -0700)]
Accept -Wno- prefix in ARI
This adds -Wno- support to ARI, so that warnings can be disabled
selectively. I use this to ignore "deprecated" warnings.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Handle -Wno- prefix.
Change-Id: I6919faedf920e857df4f597df66f0ba3943e0eac
Tom Tromey [Thu, 5 Dec 2019 15:29:03 +0000 (08:29 -0700)]
Change ARI usage to GNU style
This changes the ARI usage text to use the GNU style for
"metasyntactic variables".
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh (usage): Use GNU style.
Change-Id: Ibe5a867571382d2985d1b8b78dfef3ddd02291ff
Tom Tromey [Thu, 5 Dec 2019 15:15:51 +0000 (08:15 -0700)]
Suppress ARI warnings for vsprintf
A few spots can validly call vsprintf; this adds ARI markers to
suppress warnings at these places.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* gdbsupport/common-utils.c (string_printf, string_vprintf)
(string_vappendf): Add ARI comment.
Change-Id: Ia8665aa5d7b7331a3985b18626b19764a264447b
Tom Tromey [Thu, 5 Dec 2019 15:11:31 +0000 (08:11 -0700)]
Silence ARI warning about floatformat_to_double
This silences ARI at the one spot that is permitted to call
floatformat_to_double, and also removes the corresponding "fix" call
from gdb_ari.sh -- it was incorrect, and now is not needed.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "fix" call for
floatformat_to_double.
* target-float.c (host_float_ops<T>::from_target): Add ARI
comment.
Change-Id: I778a17a04da417c113194004dd7de3b1df381266
Tom Tromey [Thu, 5 Dec 2019 15:08:39 +0000 (08:08 -0700)]
Silence ARI for valid calls to abort
There are a handful of spots in gdb that validly call abort. This
patch adds the appropriate ARI marker to these lines, to silence the
ARI report. This also removes the "fix" call for "abort" from
gdb_ari.sh; it was incorrect and now is not needed.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "fix" call for abort.
* utils.c (abort_with_message, dump_core, internal_vproblem): Add
ARI marker to abort.
* event-top.c (handle_sigsegv): Add ARI marker to abort.
Change-Id: I09ce6aa5010bbe4e5bb73ffdb727481be39d34d6
Tom Tromey [Thu, 5 Dec 2019 15:04:42 +0000 (08:04 -0700)]
Fix ARI text for floatformat_from_double
ARI reports the wrong substitution for floatformat_from_double.
"floatformat_from_doublest" was renamed in 2017.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Fix floatformat_from_double text.
Change-Id: Ibf1b194ea509b12ae8bc30ce285c809c96218557
Tom Tromey [Thu, 5 Dec 2019 14:58:03 +0000 (07:58 -0700)]
Remove ATTRIBUTE_UNUSED check from ARI
The text for the ATTRIBUTE_UNUSED check in ARI is plainly incorrect
now -- gdb does in fact use ATTRIBUTE_UNUSED, and there's no issue in
doing so, when done properly.
This patch removes this check.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove ATTRIBUTE_UNUSED check.
Change-Id: I13fd8e9b40dbaab3978dbf9b6c4228b62299d944
Tom Tromey [Thu, 5 Dec 2019 14:53:32 +0000 (07:53 -0700)]
Remove "boolean" and "var_boolean" checks from ARI
The "boolean" and "var_boolean" checks from ARI seem only to generate
false reports.
Now that gdb is in C++, at least the "boolean" check seems unlikely to
ever generate a true report.
The "var_boolean" check likewise doesn't seem valuable any more --
presumably this refers to some ancient way of doing things in gdb, and
isn't likely to find a bug in the future.
Therefore, this patch removes these two checks.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Remove "boolean" and "var_boolean"
checks.
Change-Id: Iaf449b51e8182ffa0b9ed25fe688e0ff64a07a67
Tom Tromey [Fri, 13 Dec 2019 15:48:44 +0000 (08:48 -0700)]
Fix the gdb build with GCC 7
The Solaris buildbot builder complained about some recent patches of
mine. Building with GCC 7 failed.
This patch fixes the bug. I'm checking it in.
gdb/ChangeLog
2019-12-13 Tom Tromey <tromey@adacore.com>
* gdbsupport/safe-iterator.h (class basic_safe_range) <begin,
end>: No longer "const".
Change-Id: I5f428fab61087f467ac3b6475f4ef4dbd314fcb0
Simon Marchi [Fri, 13 Dec 2019 15:12:30 +0000 (10:12 -0500)]
Fix indentation in jit.c
Many places in this file use spaces only for indentation. Fix them to
conform to GNU style.
gdb/ChangeLog:
* jit.c: Fix indentation, replace spaces with tabs where
applicable.
This page took 0.069045 seconds and 4 git commands to generate.