John Baldwin [Fri, 28 Sep 2018 21:15:54 +0000 (14:15 -0700)]
Use the existing instruction to determine the RISC-V breakpoint kind.
RISC-V supports instructions of varying lengths. Standard existing
instructions in the base ISA are 4 bytes in length, but the 'C'
extension adds support for compressed, 2 byte instructions. RISC-V
supports two different breakpoint instructions: EBREAK is a 4 byte
instruction in the base ISA, and C.EBREAK is a 2 byte instruction only
available on processors implementing the 'C' extension. Using EBREAK
to set breakpoints on compressed instructions causes problems as the
second half of EBREAK will overwrite the first 2 bytes of the
following instruction breaking other threads in the process if their
PC is the following instruction. Thus, breakpoints on compressed
instructions need to use C.EBREAK instead of EBREAK.
Previously, the riscv architecture checked the MISA register to
determine if the 'C' extension was available. If so, it used C.EBREAK
for all breakpoints. However, the MISA register is not necessarily
available to supervisor mode operating systems. While native targets
could provide a fake MISA register value, this patch instead examines
the existing instruction at a breakpoint target to determine which
breakpoint instruction to use. If the existing instruction is a
compressed instruction, C.EBREAK is used, otherwise EBREAK is used.
gdb/ChangeLog:
* disasm-selftests.c (print_one_insn_test): Add bfd_arch_riscv to
case with explicit breakpoint kind.
* riscv-tdep.c (show_use_compressed_breakpoints): Remove
'additional_info' and related logic.
(riscv_debug_breakpoints): New variable.
(riscv_breakpoint_kind_from_pc): Use the length of the existing
instruction to determine the breakpoint kind.
(_initialize_riscv_tdep): Add 'set/show debug riscv breakpoints'
flag. Update description of 'set/show riscv
use-compressed-breakpoints' flag.
Компан, Вячеслав Олегович [Fri, 28 Sep 2018 20:00:46 +0000 (16:00 -0400)]
Change "xor" name in cpu_core to allow building with iso646.h or C++ compiler
This code was introduced back in 1998, and C99 appeared next year,
defining the `xor` as an 'alternative keyword' if iso646.h is
included. Moreover, C++98 defines it on the language level. As a
result, the code is not buildable with C++ compiler or if iso646.h is
included beforehand.
According to comment, `sim_cpu_core` is mostly a clone of `sim_core`,
so I renamed it to `byte_xor` as it's called in `sim_core`.
sim/common/ChangeLog:
* sim-core.h (sim_cpu_core): Rename cpu_core.xor to
cpu_core.byte_xor.
* sim-core.c (sim_core_set_xor): Likewise.
(sim_core_xor_read_buffer): Likewise.
(sim_core_xor_write_buffer): Likewise.
Andrew Burgess [Thu, 10 Sep 2015 12:06:16 +0000 (13:06 +0100)]
gdb: Change how frames are selected for 'frame' and 'info frame'.
The 'frame' command, and thanks to code reuse the 'info frame' and
'select-frame' commands, currently have an overloaded mechanism for
selecting a frame.
These commands take one or two parameters, if it's one parameter then
we first try to use the parameter as an integer to select a frame by
level (or depth in the stack). If that fails then we treat the
parameter as an address and try to select a stack frame by
stack-address. If we still have not selected a stack frame, or we
initially had two parameters, then GDB allows the user to view a stack
frame that is not part of the current backtrace. Internally, a new
frame is created with the given stack and pc addresses, and this is
shown to the user.
The result of this is that a typo by the user, entering the wrong stack
frame level for example, can result in a brand new frame being viewed
rather than an error.
The purpose of this commit is to remove this overloading, while still
offering the same functionality through some new sub-commands. By
making the default behaviour of 'frame' (and friends) be to select a
stack frame by level index, it is hoped that enough
backwards-compatibility is maintained that users will not be overly
inconvenienced.
The 'frame', 'select-frame', and 'info frame' commands now all take a
frame specification string as an argument, this string can be any of the
following:
(1) An integer. This is treated as a frame level. If a frame for
that level does not exist then the user gets an error.
(2) A string like 'level <LEVEL>', where <LEVEL> is a frame level
as in option (1) above.
(3) A string like 'address <STACK-ADDRESS>', where <STACK-ADDRESS>
is a stack-frame address. If there is no frame for this address
then the user gets an error.
(4) A string like 'function <NAME>', where <NAME> is a function name,
the inner most frame for function <NAME> is selected. If there is no
frame for function <NAME> then the user gets an error.
(5) A string like 'view <STACK-ADDRESS>', this views a new frame
with stack address <STACK-ADDRESS>.
(6) A string like 'view <STACK-ADDRESS> <PC-ADDRESS>', this views
a new frame with stack address <STACK-ADDRESS> and the pc <PC-ADDRESS>.
This change assumes that the most common use of the commands like
'frame' is to select a frame by frame level, it is for this reason
that this is the behaviour that is kept for backwards compatibility.
Any of the alternative behaviours, which are assumed to be less used,
now require a change in user behaviour.
The MI command '-stack-select-frame' has not been changed. This
ensures that we maintain backwards compatibility for existing
frontends.
gdb/ChangeLog:
(NEWS): Mention changes to frame related commands.
* cli/cli-decode.c (add_cmd_suppress_notification): New function.
(add_prefix_cmd_suppress_notification): New function.
(add_com_suppress_notification): Call
add_cmd_suppress_notification.
* command.h (add_cmd_suppress_notification): Declare.
(add_prefix_cmd_suppress_notification): Declare.
* mi/mi-cmd-stack.c: Add 'safe-ctype.h' include.
(parse_frame_specification): Moved from stack.c, with
simplification to handle a single argument.
(mi_cmd_stack_select_frame): Use parse_frame_specification, the
switch to the selected frame. Add a header comment.
* stack.c: Remove 'safe-ctype.h' include.
(find_frame_for_function): Add declaration.
(find_frame_for_address): New function.
(parse_frame_specification): Moved into mi/mi-cmd-stack.c.
(frame_selection_by_function_completer): New function.
(info_frame_command): Rename to...
(info_frame_command_core): ...this, and update parameter types.
(select_frame_command): Rename to...
(select_frame_command_core): ...this, and update parameter types.
(frame_command): Rename to...
(frame_command_core): ...this, and update parameter types.
(class frame_command_helper): New class to wrap implementations of
frame related sub-commands.
(frame_apply_cmd_list): New static global.
(frame_cmd_list): Make static.
(select_frame_cmd_list): New global for sub-commands.
(info_frame_cmd_list): New global for sub-commands.
(_initialize_stack): Register sub-commands for 'frame',
'select-frame', and 'info frame'. Update 'frame apply' commands
to use frame_apply_cmd_list. Move function local static
frame_apply_list to file static frame_apply_cmd_list for
consistency.
* stack.h (select_frame_command): Delete declarationn.
(select_frame_for_mi): Declare new function.
gdb/doc/ChangeLog:
* gdb.texinfo (Frames): Rewrite the description of 'frame number'
to highlight that the number is also the frame's level.
(Selection): Rewrite documentation for 'frame' and 'select-frame'
commands.
(Frame Info): Rewrite documentation for 'info frame' command.
gdb/testsuite/ChangeLog:
* gdb.base/frame-selection.exp: New file.
* gdb.base/frame-selection.c: New file.
Jim Wilson [Fri, 28 Sep 2018 00:16:34 +0000 (17:16 -0700)]
RISC-V: Pc-rel to gp-rel relaxation function cleanup.
bfd/
* elfnn-riscv.c (riscv_init_pcgp_relocs): Add explanatory comment.
(riscv_free_pcgp_relocs, riscv_record_pcgp_reloc): Likewise.
(riscv_find_pcgp_hi_reloc, riscv_reocrd_pcgp_lo_reloc): Likewise.
(riscv_find_pcgp_lo_reloc): Likewise.
(riscv_delete_pcgp_hi_reloc, riscv_use_pcgp_hi_reloc): Delete.
(riscv_delete_pcgp_lo_reloc): Likewise.
(_bfd_riscv_relax_pc): Don't call riscv_use_pcgp_hi_reloc. Replace
calls to riscv_delete_pcgp_lo_reloc and riscv_delete_pcgp_hi_reloc
with TRUE. Mark abfd arg as ATTRIBUTE_UNUSED.
GDB Administrator [Fri, 28 Sep 2018 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Hayward [Wed, 26 Sep 2018 13:06:54 +0000 (14:06 +0100)]
testsuite: Fix race condition in check-libthread-db
It is possible for the created thread to reach the breakpoint before
the main thread has set errno to 23.
Prevent this using a pthread barrier.
* gdb.threads/check-libthread-db.c (thread_routine): Use a
pthread barrier.
(main): Likewise.
GDB Administrator [Thu, 27 Sep 2018 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Wed, 26 Sep 2018 16:45:56 +0000 (09:45 -0700)]
Skip broken assembler test on Windows host.
2018-09-26 Sandra Loosemore <sandra@codesourcery.com>
gas/
* testsuite/gas/all/gas.exp: Skip "Output file must be distinct
from input" test on Windows host.
Andrew Burgess [Wed, 12 Sep 2018 16:35:08 +0000 (17:35 +0100)]
gdb/riscv: Improve non-dwarf stack unwinding
This commit improves the prologue scanning stack unwinder, to better
support AUIPC, LUI, and more variants of ADD and ADDI.
This allows unwinding over frames containing large local variables,
where the frame size does not fit into a single instruction immediate,
and is first loaded into a temporary register, before being added to
the stack pointer.
A new test is added that tests this behaviour. As there's nothing
truely RiscV specific about this test I've added it into gdb.base, but
as this depends on target specific code to perform the unwind it is
possible that some targets might fail this new test.
gdb/ChangeLog:
* riscv-tdep.c (riscv_insn::decode): Decode c.lui.
(riscv_scan_prologue): Split handling of AUIPC, LUI, ADD, ADDI,
and NOP.
gdb/testsuite/ChangeLog:
* gdb.base/large-frame-1.c: New file.
* gdb.base/large-frame-2.c: New file.
* gdb.base/large-frame.exp: New file.
* gdb.base/large-frame.h: New file.
Simon Marchi [Wed, 26 Sep 2018 12:27:23 +0000 (08:27 -0400)]
elf32-nds32: Remove elf32_nds32_allocate_dynrelocs
It is unused, removing it fixes this error when building with clang:
/home/emaisin/src/binutils-gdb/bfd/elf32-nds32.c:3172:1: error: unused function 'elf32_nds32_allocate_dynrelocs' [-Werror,-Wunused-function]
elf32_nds32_allocate_dynrelocs (struct bfd_link_info *info, asection *sreloc,
^
1 error generated.
gcc only reports the error if you remove "inline". I don't know if this
is actually a mistake and it should actually be used though.
gdb/ChangeLog:
* elf32-nds32.c (elf32_nds32_allocate_dynrelocs): Remove.
Tom Tromey [Wed, 26 Sep 2018 11:34:25 +0000 (05:34 -0600)]
Remove dead definition from valops.c
This removes a variable definition in valops.c that has been
surrounded by "#if 0" since gdb moved to sourceware.
gdb/ChangeLog
2018-09-26 Tom Tromey <tom@tromey.com>
* valops.c (auto_abandon): Remove dead code.
Tom Tromey [Mon, 3 Sep 2018 21:41:24 +0000 (15:41 -0600)]
Small fix for "winheight" usage
I noticed that the usage string for "winheight" has a couple of
extraneous ">"s in it. I must have forgotten to remove these back
when I changed the text to use the GNU style for metasyntactic
variables.
gdb/ChangeLog
2018-09-26 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (WIN_HEIGHT_USAGE): Remove extra ">"s.
GDB Administrator [Wed, 26 Sep 2018 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Tue, 25 Sep 2018 20:13:23 +0000 (13:13 -0700)]
RISC-V: Give error for RVE PLTs.
bfd/
* elfnn-riscv.c (riscv_make_plt_header): New arg output_bfd. Change
return type to bfd_boolean. If EF_RISCV_RVE call _bfd_error_handler
and return FALSE. Return TRUE at end.
(riscv_make_plt_entry): Likewise.
(riscv_elf_finish_dynamic_symbol): Update call to riscv_make_plt_entry.
(riscv_elf_finish_dynamic_sections): Update call to
riscv_make_plt_header.
Andreas Krebbel [Tue, 25 Sep 2018 15:13:28 +0000 (17:13 +0200)]
S/390: Fix symbolic displacement in lay
Increase the fixup length to 4 for the 20 bit displacement.
gas/ChangeLog:
2018-09-25 Andreas Krebbel <krebbel@linux.ibm.com>
* config/tc-s390.c (md_apply_fix): Set fx_size to 4 for 20 bit
displacements.
* testsuite/gas/s390/s390.exp: Run new test.
* testsuite/gas/s390/zarch-z990-symbol-lay.s: New test.
Tom Tromey [Tue, 31 Jul 2018 13:49:55 +0000 (07:49 -0600)]
Remove dead code from gdbserver's configure
gdbserver's configure removes -Wmissing-prototypes from the warning
flags. However, this flag is only useful for C, so this deletion is
no longer needed.
gdb/gdbserver/ChangeLog
2018-09-25 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac (WARN_CFLAGS): Don't remove -Wmissing-prototypes.
Eric Botcazou [Tue, 25 Sep 2018 06:15:36 +0000 (08:15 +0200)]
Couple of minor tweaks to the linker testsuite.
This gets rid of the couple of linker failures for visium-elf:
FAIL: ld-elf/pr14156b
FAIL: ld-elf/pr22677
by tweaking the respective testcases. The first tweak is the same as the
one made to the sibling testcase ld-elf/pr14156a.d about one year ago and
the second tweak adds the usual main/start/_start/__start symbols.
ld/
* testsuite/ld-elf/pr14156b.d: Adjust for extra symbols.
* testsuite/ld-elf/pr22677.s: Define main/start/_start/__start.
GDB Administrator [Tue, 25 Sep 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 24 Sep 2018 21:36:41 +0000 (14:36 -0700)]
RISC-V: For PCREL_LO12, fix addend handling in auipc lookup.
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_pc) <R_RISCV_PCREL_LO12_I>: New local
hi_sec_off which is symbol address with addend subtracted. Use in
riscv_find_pcgp_hi_reloc and riscv_record_pcgp_lo_reloc calls.
Jim Wilson [Mon, 24 Sep 2018 21:05:32 +0000 (14:05 -0700)]
RISC-V: Allow pcrel_lo addends, error on addend overflow.
bfd/
* elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Add check for reloc
overflow with addend. Use reloc_dangerous instead of reloc_overflow.
Add strings for the two errors handled here.
(riscv_elf_relocate_section) In case R_RISCV_PCREL_LO12_I, rewrite
comment. Only give error with addend when used with section symbol.
In case bfd_reloc_dangerous, update error string.
ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run pcrel-lo-addend-2.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.d: New.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend-2.s: New.
* testsuite/ld-riscv/elf/ld-riscv-elf/pcrel-lo-addend.d: Update name
and error string.
Jozef Lawrynowicz [Tue, 11 Sep 2018 21:56:36 +0000 (22:56 +0100)]
Fix PR gdb/20948: --write option to GDB causes segmentation fault
When opening a BFD for update, as gdb --write does, modifications to
anything but the contents of sections is restricted.
Do not try to write back any ELF headers in this case.
bfd/ChangeLog
2018-09-24 Jozef Lawrynowicz <jozef.l@mittosystems.com>
PR gdb/20948
* elf.c (_bfd_elf_write_object_contents): Return from function
early if abfd->direction == both_direction.
gdb/testsuite/ChangeLog
2018-09-24 Jozef Lawrynowicz <jozef.l@mittosystems.com>
PR gdb/20948
* gdb.base/write_mem.exp: New test.
* gdb.base/write_mem.c: Likewise.
Tom Tromey [Mon, 24 Sep 2018 12:15:17 +0000 (06:15 -0600)]
Add "const" to a few locals in gdb
I noticed that some code in gdb was doing:
char *mumble = getenv (...)
However, using "const char *" here would be clearer.
This patch fixes the instances I could readily build.
Tested by rebuilding.
gdb/ChangeLog
2018-09-24 Tom Tromey <tom@tromey.com>
* common/pathstuff.c (get_standard_cache_dir): Make
"xdg_cache_home" and "home" const.
* top.c (init_history): Make "tmpenv" const.
* main.c (get_init_files): Make "homedir" const.
Tom Tromey [Sat, 15 Sep 2018 07:09:22 +0000 (01:09 -0600)]
Allow setting a parameter to raise gdb.GdbError
A convention in the Python layer is that raising a gdb.GdbError will
not print the Python stack -- instead the exception is treated as any
other gdb exception.
PR python/18852 asks that this treatment be extended the the
get_set_value method of gdb.Parameter. This makes sense, because it
lets Python-created parameters act like gdb parameters.
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18852:
* python/py-param.c (get_set_value): Use gdbpy_handle_exception.
gdb/doc/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18852:
* python.texi (Parameters In Python): Document exception behavior
of get_set_string.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18852:
* gdb.python/py-parameter.exp: Add test for parameter that throws
on "set".
Tom Tromey [Sat, 15 Sep 2018 06:57:12 +0000 (00:57 -0600)]
Consolidate gdb.GdbError handling
I noticed two nearly identical copies of the same code for handling
gdb.GdbError. The only differences were in some error messages.
These differences didn't seem very important, so this patch pulls the
code out into a new function.
2018-09-23 Tom Tromey <tom@tromey.com>
* python/py-function.c (fnpy_call): Use gdbpy_handle_exception.
* python/py-cmd.c (cmdpy_function): Use gdbpy_handle_exception.
* python/python-internal.h (gdbpy_handle_exception): Declare.
* python/py-utils.c (gdbpy_handle_exception): New function.
Tom Tromey [Sat, 15 Sep 2018 06:29:20 +0000 (00:29 -0600)]
Check for negative argument in Type.template_argument
typy_template_argument did not check if the template argument was
non-negative. A negative value could cause a gdb crash.
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/17284:
* python/py-type.c (typy_template_argument): Check for negative
argument number.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/17284:
* gdb.python/py-template.exp (test_template_arg): Add test for
negative template argument number.
Tom Tromey [Sat, 15 Sep 2018 06:07:32 +0000 (00:07 -0600)]
Report Python errors coming from gdb.post_event
PR python/14062 points out that errors coming from the gdb.post_event
callback are not reported. This can make it hard to understand why
your Python code in gdb isn't working.
Because users have control over whether exceptions are printed at all,
it seems good to simply have post_event report errors in the usual
way.
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/14062:
* python/python.c (gdbpy_run_events): Do not ignore exceptions.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/14062:
* gdb.python/python.exp: Add test for post_event error.
Tom Tromey [Sat, 15 Sep 2018 05:20:58 +0000 (23:20 -0600)]
Allow conversion of pointers to Python int
PR python/18170 questions why it's not possible to convert a pointer
value to a Python int.
Digging a bit shows that the Python 2.7 int() constructor will happily
return a long in some cases. And, it seems gdb already understands
this in other places -- this is what gdb_py_object_from_longest
handles.
So, this patch simply extends valpy_int to allow pointer conversions,
as valpy_long does.
gdb/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18170:
* python/py-value.c (valpy_int): Allow conversion from pointer
type.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18170:
* gdb.python/py-value.exp (test_value_numeric_ops): Add tests to
convert pointers to int and long.
Tom Tromey [Sat, 15 Sep 2018 04:44:10 +0000 (22:44 -0600)]
Preserve sign when converting gdb.Value to Python int
PR python/20126 points out that sometimes the conversion of a
gdb.Value can result in a negative Python integer. This happens
because valpy_int does not examine the signedness of the value's type.
gdb/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/20126:
* python/py-value.c (valpy_int): Respect type sign.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/20126:
* gdb.python/py-value.exp (test_value_numeric_ops): Add
signed-ness conversion tests.
Tom Tromey [Sat, 15 Sep 2018 04:31:12 +0000 (22:31 -0600)]
Allow more Python scalar conversions
PR python/18352 points out that the gdb Python code can't convert an
integer-valued gdb.Value to a Python float. While writing the test I
noticed that, similarly, converting integer gdb.Values to float does
not work. However, all of these cases seem reasonable.
gdb/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18352;
* python/py-value.c (valpy_float): Allow conversions from int or
char.
(valpy_int, valpy_long): Allow conversions from float.
gdb/testsuite/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
PR python/18352;
* gdb.python/py-value.exp (test_float_conversion): New proc.
Use it.
GDB Administrator [Mon, 24 Sep 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Sun, 23 Sep 2018 19:31:23 +0000 (12:31 -0700)]
Fix incorrect extraction of signed constants in nios2 disassembler.
2018-09-23 Sandra Loosemore <sandra@codesourcery.com>
opcodes/
* nios2-dis.c (nios2_print_insn_arg): Make sure signed conversions
are used when extracting signed fields and converting them to
potentially 64-bit types.
Tom Tromey [Tue, 18 Sep 2018 22:45:59 +0000 (16:45 -0600)]
Mark more file descriptors close-on-exec
I noticed a couple of spots in gdb that were opening files but not
marking the file descriptors as close-on-exec. This patch fixes
these.
There are still a few more of these, but they are in code that I can't
compile, so I'd prefer not to touch.
gdb/ChangeLog
2018-09-23 Tom Tromey <tom@tromey.com>
* ctf.c (ctf_start): Use gdb_fopen_cloexec.
* common/scoped_mmap.c (mmap_file): Use gdb_open_cloexec.
Rainer Orth [Sun, 23 Sep 2018 17:49:14 +0000 (19:49 +0200)]
Also recognize __sighndlr on Solaris/x86
Unlike Solaris/SPARC, the __sighndlr function isn't recognized as part
of a signal handler, causing a couple of testcases to fail.
The following patch fixes that. A followup patch will move this to
common code to avoid such unnecessary discrepancies between
Solaris/SPARC and x86 in the future.
While this fixes a couple of backtraces to now correctly print
#1 <signal handler called>
they often fail later with
#2 0x0ff3ffffff00857f in ?? ()
Backtrace stopped: Cannot access memory at address 0xff3000002e0886f
which needs further investigation.
Tested on amd64-pc-solaris2.11 (running the tests with both -m64 and
-m32).
* amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Also recognize
__sighndlr.
* i386-sol2-tdep.c (i386_sol2_sigtramp_p): Likewise.
Jon Turney [Mon, 26 Sep 2016 14:45:28 +0000 (15:45 +0100)]
Remove a spurious target_terminal::ours() from windows_nat_target::wait()
This causes the inferior to stop with SIGTTIN if it tries to read from the
terminal after it has been continued.
See https://cygwin.com/ml/cygwin/2016-09/msg00285.html for reproduction.
Since MinGW doesn't have a tcsetpgrp(), I don't think this problem would be
observed there, but Cygwin does so target_terminal::ours() will call it.
Calling target_terminal::ours() here seems to be is no longer appropriate
after the "Merge async and sync code paths" changes (as the inferior is now
in a separate process group even in sync mode(?), which is always used on
Windows targets)
This call was added in commit
c44537cf (and see
https://sourceware.org/ml/gdb-patches/2007-02/msg00167.html for what it
fixed, which is not regressed by this change)
When windows_nat_target::wait() is entered, the inferior is running (either
it's been just been started or attached to, or windows_continue() was
called), so grabbing the controlling terminal away from it here seems to be
wrong, since infrun.c takes care of calling target_terminal::ours() when the
inferior stops.
gdb/ChangeLog:
2018-08-02 Jon Turney <jon.turney@dronecode.org.uk>
* windows-nat.c (windows_nat_target::wait): Remove a spurious
target_terminal::ours().
Simon Marchi [Sun, 23 Sep 2018 14:12:29 +0000 (10:12 -0400)]
Fix build error in aarch64-linux-tdep.c on macOS
When building with --enable-targets=all on macOS, I get this error:
CXX aarch64-linux-tdep.o
/Users/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:328:7: error: no matching function for call to 'store_integer'
store_integer ((gdb_byte *)&vg_target, sizeof (uint64_t), byte_order,
^~~~~~~~~~~~~
/Users/simark/src/binutils-gdb/gdb/defs.h:556:13: note: candidate template ignored: requirement 'Or<is_same<unsigned long long, long>, is_same<unsigned long long, unsigned long> >::value' was not satisfied [with T = unsigned long long]
extern void store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
^
I believe it's because uint64_t is defined as "unsigned long long" on macOS,
even though "unsigned long" is also 64 bits. Other 64-bits platforms define
uint64_t as "unsigned long".
This makes the type of the argument to store_integer (unsigned long long) not
match the requirement that it must be the same as ULONGEST, which is unsigned
long.
Fix it by changing the type of the vl variable to be ULONGEST, which is what
extract_unsigned_integer returns anyway.
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_linux_supply_sve_regset): Change type
of vl to ULONGEST.
GDB Administrator [Sun, 23 Sep 2018 00:00:57 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 22 Sep 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Fri, 21 Sep 2018 03:16:03 +0000 (12:46 +0930)]
Revert part of commit
32ec8896025
echo "__thread char *p;" | gcc -c -g -xc - -o thread.o
With current powerpc64le-linux-gcc has this reloc in .debug_info
0000000000000025 0000000d0000004e R_PPC64_DTPREL64
0000000000000000 p + 8000
That stops me looking at .debug_info.
~/build/gas-virgin/powerpc64le-linux/binutils/readelf -wi thread.o
readelf: Warning: unable to apply unsupported reloc type 78 to section .debug_info
Older readelf continued on after the warning, dumping .debug_info.
* readelf.c (apply_relocations): Don't return FALSE for warnings.
Simon Marchi [Fri, 21 Sep 2018 14:27:48 +0000 (10:27 -0400)]
csky-opc.h: Initialize fields of last array elements
clang gives these errors:
In file included from /Users/simark/src/binutils-gdb/opcodes/csky-dis.c:30:
/Users/simark/src/binutils-gdb/opcodes/csky-opc.h:2330:8: error: missing field 'transfer' initializer [-Werror,-Wmissing-field-initializers]
{NULL}
^
/Users/simark/src/binutils-gdb/opcodes/csky-opc.h:8126:10: error: missing field 'transfer' initializer [-Werror,-Wmissing-field-initializers]
{NULL}
^
They go away when we Initialize all fields. I noticed there used to be some
files built with -Wno-missing-field-initializers, but it's not the case
anymore, since commit
e7ae278d0474ab84ba3b1ee932a19e83616ddacc. There is still
a NO_WMISSING_FIELD_INITIALIZERS variable defined in the Makefile, but it's
unused, so I removed it to avoid further confusion.
opcodes/ChangeLog:
* Makefile.am: Remove NO_WMISSING_FIELD_INITIALIZERS.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
* configure.ac: Remove check for -Wno-missing-field-initializers.
* csky-opc.h (csky_v1_opcodes): Initialize all fields of last element.
(csky_v2_opcodes): Likewise.
Simon Marchi [Fri, 21 Sep 2018 14:27:30 +0000 (10:27 -0400)]
elf32-nds32: Don't define fls if it is provided by the system
The fls function already exists on macOS and FreeBSD (and probably others),
leading to this error:
/Users/simark/src/binutils-gdb/bfd/elf32-nds32.c:5074:1: error: static declaration of 'fls' follows non-static declaration
fls (register unsigned int x)
^
/usr/include/strings.h:87:6: note: previous declaration is here
int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^
Add a configure-time check for it, and only define it if the system doesn't
provide it.
bfd/ChangeLog:
* configure.ac: Check for fls.
* elf32-nds32.c (fls): Only define if !HAVE_FLS.
* config.in: Re-generate.
* configure: Re-generate.
Yacov Simhony [Fri, 21 Sep 2018 13:53:51 +0000 (07:53 -0600)]
Remove redundant test in update_inserted_breakpoint_locations
Remove a redundant test in update_inserted_breakpoint_locations.
gdb/ChangeLog
2018-09-21 Yacov Simhony <ysimhony@gmail.com>
* breakpoint.c (update_inserted_breakpoint_locations): Remove
redundant condition.
H.J. Lu [Fri, 21 Sep 2018 11:36:08 +0000 (04:36 -0700)]
Correct ChangeLog entry for commit
b8426d169d3f8a
commit
b8426d169d3f8ab820f3bdaf45fbc64f8bb827ed
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Sep 21 04:24:40 2018 -0700
gas: Make bfin-parse.c/rl78-parse.c/rx-parse.c depend on bfd/reloc.c
It is for PR gas/23691, not PR gas/23692.
H.J. Lu [Fri, 21 Sep 2018 11:24:40 +0000 (04:24 -0700)]
gas: Make bfin-parse.c/rl78-parse.c/rx-parse.c depend on bfd/reloc.c
Since bfin-parse.c, rl78-parse.c and rx-parse.c use BFD_RELOC_XXX, we
need to regenerate them when bfd/reloc.c changhes.
PR gas/23692
* Makefile.am (bfin-parse.c): Depend on $(srcdir)/../bfd/reloc.c.
(rl78-parse.c): Likewise.
(rx-parse.c): Likewise.
* Makefile.in: Regenerated.
H.J. Lu [Fri, 21 Sep 2018 11:07:50 +0000 (04:07 -0700)]
ELF: Don't include zero size sections at start of PT_NOTE segment
We shouldn't include zero size sections at start of PT_NOTE segment,
similar to PT_DYNAMIC segment.
PR binutils/23694
* include/elf/internal.h (ELF_SECTION_IN_SEGMENT_1): Don't
include zero size sections at start of PT_NOTE segment.
Alan Modra [Fri, 21 Sep 2018 00:22:08 +0000 (09:52 +0930)]
Fix more fallout from
17f6ade235fc
gas/
* testsuite/gas/avr/large-debug-line-table.d: Update.
ld/
* testsuite/ld-avr/gc-section-debugline.d: Update.
GDB Administrator [Fri, 21 Sep 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 20 Sep 2018 19:28:09 +0000 (12:28 -0700)]
ld: Add the entry symbol, _main, for LynxOS targets
Add the entry symbol, _main, to fix:
FAIL: ld-elf/64ksec
FAIL: ld-elf/comm-data4
FAIL: ld-elf/comm-data5
FAIL: ld-elf/eh5
FAIL: ld-elf/empty
FAIL: ld-elf/empty2
FAIL: ld-elf/endsym
FAIL: ld-elf/exclude3a
FAIL: ld-elf/linkonce2
FAIL: ld-elf/orphan3
FAIL: ld-elf/pr12851
FAIL: ld-elf/pr14156a
FAIL: ld-elf/pr14156b
FAIL: ld-elf/pr14926
FAIL: ld-elf/pr20513a
FAIL: ld-elf/pr20513b
FAIL: ld-elf/stab
FAIL: ld-elf/var1
FAIL: ld-elf/warn3
FAIL: section size overflow
for i386-lynxos target.
* testsuite/ld-checks/over2.s: Add "_main" for LynxOS targets.
* testsuite/ld-elf/comm-data4.s: Likewise.
* testsuite/ld-elf/comm-data5.s: Likewise.
* testsuite/ld-elf/eh5b.s: Likewise.
* testsuite/ld-elf/empty.s: Likewise.
* testsuite/ld-elf/empty2.s: Likewise.
* testsuite/ld-elf/exclude3.s: Likewise.
* testsuite/ld-elf/fini0.s: Likewise.
* testsuite/ld-elf/init0.s: Likewise.
* testsuite/ld-elf/linkonce1b.s: Likewise.
* testsuite/ld-elf/orphan3a.s: Likewise.
* testsuite/ld-elf/pr14926.s: Likewise.
* testsuite/ld-elf/pr20513a.s: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-elf/start.s: Likewise.
* testsuite/ld-elf/var1.s: Likewise.
Jim Wilson [Thu, 20 Sep 2018 19:06:28 +0000 (12:06 -0700)]
RISC-V: Fix library search path for rv32.
2018-09-19 Kito Cheng <kito@andestech.com>
ld/
* emulparams/elf32lriscv.sh: Correct the library search path.
* emulparams/elf32lriscv_ilp32.sh: Likewise.
* emulparams/elf32lriscv_ilp32f.sh: Likewise.
Rainer Orth [Thu, 20 Sep 2018 18:01:05 +0000 (20:01 +0200)]
More Solaris procfs cleanup
This procfs.c (and friends) cleanup patch grew along a couple of lines:
* First I noticed that PR_MODEL_NATIVE is always defined now that
Solaris 10 is the minimum supported version.
* Then there was a cleanup that I'd missed when removing support for
!NEW_PROC_API, IRIX, and Tru64 UNIX: given that sysset_t is no longer
dynamic, there's no need for the special sysset_t_alloc, but we can
just use XNEW instead.
* Then I found one of those ARI warning mails on gdb-patches, discovered
how to run it myself and fixed a large number of the warnings, among
them all uses of sprintf.
I had to silence the warnings in only 3 instances of the same issue,
namely references to LDT in function names which are due to the
libthread_db API.
* Even so, there were several formatting glitches, like braces around
single statements in an if, which I chose to fix while I was at it.
The result has been tested on amd64-pc-solaris2.11 and
amd64-pc-solaris2.11.
* proc-utils.h (PROC_CTL_WORD_TYPE): Remove.
* procfs.c: Don't check for PR_MODEL_NATIVE definition.
* sparc-sol2-nat.c: Likewise. Remove Linux, __arch64__ references.
* sol-thread.c (ps_pdmodel): Don't guard definition.
* procfs.c: Fix formatting.
* procfs.c (sysset_t_alloc): Remove.
(create_procinfo): Use XNEW instead of sysset_t_alloc.
(procfs_debug_inferior): Likewise.
(procfs_set_exec_trap): Likewise.
(proc_set_traced_sysentry): Don't allocate argp dynamically.
(proc_set_traced_sysexit): Likewise.
* procfs.c (create_procinfo): Use xsnprintf to fix ARI warning.
(dead_procinfo): Likewise.
(proc_warn): Likewise.
(proc_error): Likewise.
(proc_get_LDT_entry): Likewise.
(do_attach): Likewise.
(procfs_target::pid_to_str): Likewise.
(iterate_over_mappings): Likewise.
* procfs.c (create_procinfo): Fix ARI warning.
(proc_get_status): Likewise.
(proc_stop_process): Likewise.
(proc_run_process): Likewise.
(proc_kill): Likewise.
(proc_get_LDT_entry): Likewise.
(procfs_find_LDT_entry): Likewise.
(proc_update_threads): Likewise.
(proc_iterate_over_threads): Likewise.
(do_attach): Likewise.
(procfs_xfer_memory): Likewise.
(invalidate_cache): Likewise.
(procfs_target::resume): Likewise.
(procfs_init_inferior): Likewise.
(procfs_set_exec_trap): Likewise.
(procfs_target::thread_alive): Likewise.
(procfs_target::pid_to_exec_file): Likewise.
(iterate_over_mappings): Likewise.
(procfs_target::make_corefile_notes): Likewise.
* sol-thread.c (sol_thread_target::thread_alive): Likewise.
* procfs.c (procfs_find_LDT_entry): Silence ARI warning.
(procfs_find_LDT_entry): Likewise.
* sol-thread.c (ps_lgetLDT): Likewise.
H.J. Lu [Thu, 20 Sep 2018 17:55:36 +0000 (10:55 -0700)]
gas: Update expected outputs of "readelf -wL"
Update expected outputs of "readelf -wL" for
commit
17f6ade235fc96b4e572b5251b344d426c5f1cd5
Author: John Darrington <john@darrington.wattle.id.au>
Date: Wed Sep 19 19:56:29 2018 +0200
binutils --dwarf=decodedline: Add display of is_stmt flag
which adds display of is_stmt flag.
PR binutils/23695
* testsuite/gas/elf/dwarf2-11.d: Update expected outputs of
"readelf -wL".
* testsuite/gas/elf/dwarf2-12.d: Likewise.
* testsuite/gas/elf/dwarf2-13.d: Likewise.
* testsuite/gas/elf/dwarf2-14.d: Likewise.
* testsuite/gas/elf/dwarf2-15.d: Likewise.
* testsuite/gas/elf/dwarf2-16.d: Likewise.
* testsuite/gas/elf/dwarf2-17.d: Likewise.
* testsuite/gas/elf/dwarf2-18.d: Likewise.
* testsuite/gas/elf/dwarf2-5.d: Likewise.
* testsuite/gas/elf/dwarf2-6.d: Likewise.
* testsuite/gas/elf/dwarf2-7.d: Likewise.
John Darrington [Wed, 19 Sep 2018 17:56:29 +0000 (19:56 +0200)]
binutils --dwarf=decodedline: Add display of is_stmt flag
binutils/
* dwarf.c (display_debug_lines_decoded): Add display of is_stmt.
* testsuite/binutils-all/dw5.W: Deal with the consequences.
* testsuite/binutils-all/objdump.WL: Deal with the consequences.
Hafiz Abid Qadeer [Tue, 18 Sep 2018 10:23:30 +0000 (11:23 +0100)]
Add '_' in the match pattern.
I was looking at GDB testcase results for arm-eabi target with qemu and
noticed that register groups returned by the qemu can have '_' in the
name e.g. 'cp_regs'. The reggroups.exp fails to recognize that as group
name. Fixed by adding '_' in the pattern.
2018-09-20 Hafiz Abid Qadeer <abidh@codesourcery.com>
gdb.base/reggroups.exp (fetch_reggroups): Add '_' in match pattern.
Maciej W. Rozycki [Thu, 20 Sep 2018 14:49:01 +0000 (15:49 +0100)]
S12Z/GAS: Correct a signed vs unsigned comparison error with GCC 4.1
Fix a build error:
cc1: warnings being treated as errors
.../gas/config/tc-s12z.c: In function 'lex_opr':
.../gas/config/tc-s12z.c:617: warning: comparison between signed and unsigned
.../gas/config/tc-s12z.c:624: warning: comparison between signed and unsigned
make[4]: *** [config/tc-s12z.o] Error 1
observed with GCC 4.1.2 with the `s12z-elf' target.
Here we have a constant assembly instruction operand, whose value is
within the 24-bit unsigned range, to be placed in a machine instruction
such as to use the least space-consuming encoding. So the sign of that
value does not matter, because signed values are out of range and are
not supposed to appear here, and we only have this warning here because
the `X_add_number' member of `struct expressionS' is of the `offsetT'
type, which is signed.
Use an auxiliary variable of an unsigned data type then, observing that
both `offsetT' and `valueT' have the same width, as they correspond to
`bfd_signed_vma' and `bfd_vma' respectively.
gas/
* config/tc-s12z.c (lex_opr): Use an auxiliary unsigned variable
in encoding a constant operand.
Maciej W. Rozycki [Thu, 20 Sep 2018 14:49:01 +0000 (15:49 +0100)]
PPC/GAS: Correct a signed vs unsigned comparison error with GCC 4.1
Fix a build error:
cc1: warnings being treated as errors
.../gas/config/tc-ppc.c: In function 'ppc_dwsect':
.../gas/config/tc-ppc.c:4091: warning: comparison between signed and unsigned
make[4]: *** [config/tc-ppc.o] Error 1
observed with GCC 4.1.2 with the `powerpc-beos' target.
Here `flag' identifies the type of a DWARF section, as used with the the
first operand to the `.dwsect' pseudo-op, and has no notion of a sign,
or for that matter being arithmetic in the first place[1]. We already
handle this correctly with the `flag' member of the `xcoff_dwsect_name'
structure, however not in the local variable used in GAS to hold the
parsed value of said `.dwsect' pseudo-op's operand.
Use an unsigned data type in GAS then too, observing that both `offsetT'
and `valueT' have the same width, as they correspond to `bfd_signed_vma'
and `bfd_vma' respectively.
References:
[1] "AIX Version 7.2: Assembler Language Reference", IBM Corporation
2015, 2018, Section ".dwsect pseudo-op", pp. 531-532
gas/
* config/tc-ppc.c (ppc_dwsect): Use `valueT' rather than
`offsetT' as the type of `flag'.
Maciej W. Rozycki [Thu, 20 Sep 2018 14:49:00 +0000 (15:49 +0100)]
ARC: Fix build errors with large constants and C89
Fix build errors:
cc1: warnings being treated as errors
In file included from .../opcodes/arc-opc.c:2630:
.../opcodes/arc-nps400-tbl.h:38: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:38: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:41: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:41: warning: integer constant is too large for 'long' type
[...]
.../opcodes/arc-nps400-tbl.h:712: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:712: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:715: warning: integer constant is too large for 'long' type
.../opcodes/arc-nps400-tbl.h:715: warning: integer constant is too large for 'long' type
make[4]: *** [arc-opc.lo] Error 1
and:
cc1: warnings being treated as errors
.../gas/config/tc-arc.c: In function 'md_number_to_chars_midend':
.../gas/config/tc-arc.c:802: warning: integer constant is too large for 'long' type
.../gas/config/tc-arc.c:810: warning: integer constant is too large for 'long' type
make[4]: *** [config/tc-arc.o] Error 1
observed with GCC 4.1.2 and presumably other C89 compilers with the
`arc-elf' and `arc-linux-gnu' targets, caused by the use of constants
the values of which are outside the range of the `int' type (or the
`long' type if it is of the same with). In the C89 language standard
such constants are not implicitly converted to a wider type and an
explicit suffix is required for such constants.
Add a `ull' suffix then as with such constants used in other ports.
gas/
* config/tc-arc.c (md_number_to_chars_midend): Append `ull' to
large constants.
opcodes/
* arc-nps400-tbl.h: Append `ull' to large constants throughout.
Maciej W. Rozycki [Thu, 20 Sep 2018 14:49:00 +0000 (15:49 +0100)]
RS6000/BFD: Remove dead duplicate `config.bfd' target matchers
Remove duplicate `rs6000-*-aix5.[01]' and `rs6000-*-aix[5-9]*' target
configuration selectors meant to correspond to `powerpc64-*-aix5.[01]'
and `powerpc64-*-aix[5-9]*' respectively for the purpose of BFD target
vector selection in `config.bfd'.
These selectors were added with commit
9a9e2ca33263 ("rs6000 xcoff bfd
config"), <https://sourceware.org/ml/binutils/2010-12/msg00372.html>,
and have been dead right from the beginning, because they appear twice
each in the case statement, which means the earlier instance of each
takes precedence and the other one is ignored. Here ones that alias to
`powerpc-*-aix5.[01]' and `powerpc-*-aix[5-9]*' respectively immediately
above are used instead.
bfd/
* config.bfd <rs6000-*-aix5.[01], rs6000-*-aix[5-9]*>: Remove
duplicate `case' selectors.
Nick Clifton [Thu, 20 Sep 2018 12:27:31 +0000 (13:27 +0100)]
Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream!
We have not only removed all unsupported and obsolete code, but also supported lost of new features,
including better link-time relaxations and TLS implementations. Besides, the files generated by the
newly assembler and linker usually get higher performance and more optimized code size.
ld * emultempl/nds32elf.em (hyper_relax): New variable.
(nds32_elf_create_output_section_statements):
the parameters of bfd_elf32_nds32_set_target_option
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_OPTIONS,
PARSE_AND_LIST_ARGS_CASES): Add new option --mhyper-relax.
* emultempl/nds32elf.em (nds32_elf_after_open): Updated.
* emultempl/nds32elf.em (tls_desc_trampoline): New variable.
* (nds32_elf_create_output_section_statements): Updated.
* (nds32_elf_after_parse): Disable relaxations when PIC is enable.
* (PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_OPTIONS,
PARSE_AND_LIST_ARGS_CASES): Add new option --m[no-]tlsdesc-trampoline.
include * elf/nds32.h: Remove the unused target features.
* dis-asm.h (disassemble_init_nds32): Declared.
* elf/nds32.h (E_NDS32_NULL): Removed.
(E_NDS32_HAS_DSP_INST, E_NDS32_HAS_ZOL): New.
* opcode/nds32.h: Ident.
(N32_SUB6, INSN_LW): New macros.
(enum n32_opcodes): Updated.
* elf/nds32.h: Doc fixes.
* elf/nds32.h: Add R_NDS32_LSI.
* elf/nds32.h: Add new relocations for TLS.
gas * config/tc-nds32.c: Remove the unused target features.
(nds32_relax_relocs, md_pseudo_table, nds32_elf_record_fixup_exp,
nds32_set_elf_flags_by_insn, nds32_insert_relax_entry,
nds32_apply_fix): Likewise.
(nds32_no_ex9_begin): Removed.
* config/tc-nds32.c (add_mapping_symbol_for_align,
make_mapping_symbol, add_mapping_symbol): New functions.
* config/tc-nds32.h (enum mstate): New.
(nds32_segment_info_type): Likewise.
* configure.ac (--enable-dsp-ext, --enable-zol-ext): New options.
* config.in: Regenerated.
* configure: Regenerated.
* config/tc-nds32.c (nds32_dx_regs):
Set the value according to the configuration.
(nds32_perf_ext, nds32_perf_ext2, nds32_string_ext, nds32_audio_ext):
Likewise.
(nds32_dsp_ext): New variable. Set the value according to the
configuration.
(nds32_zol_ext): Likewise.
(asm_desc, nds32_pseudo_opcode_table): Make them static.
(nds32_set_elf_flags_by_insn): Updated.
(nds32_check_insn_available): Updated.
(nds32_str_tolower): New function.
* config/tc-nds32.c (relax_table): Updated.
(md_begin): Updated.
(md_assemble): Use XNEW macro to allocate space for `insn.info',
and then remember to free it.
(md_section_align): Cast (-1) to ValueT.
(nds32_get_align): Cast (~0U) to addressT.
(nds32_relax_branch_instructions): Updated.
(md_convert_frag): Add new local variable `final_r_type'.
(invalid_prev_frag): Add new bfd_boolean parameter `relax'.
All callers changed.
* config/tc-nds32.c (struct nds32_relocs_pattern): Add `insn' field.
(struct nds32_hint_map): Add `option_list' field.
(struct suffix_name, suffix_table): Remove the unused `pic' field.
(do_pseudo_b, do_pseudo_bal): Remove the suffix checking.
(do_pseudo_la_internal, do_pseudo_pushpopm): Indent.
(relax_hint_bias, relax_hint_id_current): New static variables.
(reset_bias, relax_hint_begin): New variables.
(nds_itoa): New function.
(CLEAN_REG, GET_OPCODE): New macros.
(struct relax_hint_id): New.
(nds32_relax_hint): For .relax_hint directive, we can use `begin'
and `end' to mark the relax pattern without giving exactly id number.
(nds32_elf_append_relax_relocs): Handle the case that the .relax_hint
directives are attached to pseudo instruction.
(nds32_elf_save_pseudo_pattern): Change the second parameter from
instruction's opcode to byte code.
(nds32_elf_build_relax_relation): Add new bfd_boolean parameter
`pseudo_hint'.
(nds32_lookup_pseudo_opcode): Fix the overflow issue.
(enum nds32_insn_type): Add N32_RELAX_ALU1 and N32_RELAX_16BIT.
(nds32_elf_record_fixup_exp, relax_ls_table, hint_map,
nds32_find_reloc_table, nds32_match_hint_insn, nds32_parse_name):
Updated.
* config/tc-nds32.h (MAX_RELAX_NUM): Extend it to 6.
(enum nds32_relax_hint_type): Merge NDS32_RELAX_HINT_LA and
NDS32_RELAX_HINT_LS into NDS32_RELAX_HINT_LALS. Add
NDS32_RELAX_HINT_LA_PLT, NDS32_RELAX_HINT_LA_GOT and
NDS32_RELAX_HINT_LA_GOTOFF.
* config/tc-nds32.h (relax_ls_table): Add floating load/store
to gp relax pattern.
(hint_map, nds32_find_reloc_table): Likewise.
* configure.ac: Define NDS32_LINUX_TOOLCHAIN.
* configure: Regenerated.
* config.in: Regenerated.
* config/tc-nds32.h (enum nds32_ramp): Updated.
(enum nds32_relax_hint_type): Likewise.
* config/tc-nds32.c: Include "errno.h" and "limits.h".
(relax_ls_table): Add TLS relax patterns.
(nds32_elf_append_relax_relocs): Attach BFD_RELOC_NDS32_GROUP on
each instructions of TLS patterns.
(nds32_elf_record_fixup_exp): Updated.
(nds32_apply_fix): Likewise.
(suffix_table): Add TLSDESC suffix.
binutils* testsuite/binutils-all/objcopy.exp: Set the unsupported reloc number
from 215 to 255 for NDS32.
bfd * elf32-nds32.c (nds32_elf_relax_loadstore):
Remove the unused target features.
(bfd_elf32_nds32_set_target_option): Remove the unused parameters.
(nds32_elf_relax_piclo12, nds32_elf_relax_letlslo12,
nds32_elf_relax_letlsadd, nds32_elf_relax_letlsls,
nds32_elf_relax_pltgot_suff, nds32_elf_relax_got_suff
nds32_elf_relax_gotoff_suff, calculate_plt_memory_address,
calculate_plt_offset, calculate_got_memory_address,
nds32_elf_check_dup_relocs): Removed.
All callers changed.
* elf32-nds32.h: Remove the unused macros and defines.
(elf_nds32_link_hash_table): Remove the unused variable.
(bfd_elf32_nds32_set_target_option): Update prototype.
(nds32_elf_ex9_init): Removed.
* elf32-nds32.c (nds32_convert_32_to_16): Updated.
* elf32-nds32.c (HOWTO2, HOWTO3): Define new HOWTO macros
to initialize array nds32_elf_howto_table in any order
without lots of EMPTY_HOWTO.
(nds32_reloc_map): Updated.
* reloc.c: Add BFD_RELOC_NDS32_LSI.
* bfd-in2.h: Regenerated.
* bfd/libbfd.h: Regenerated.
* elf32-nds32.c (nds32_elf_relax_howto_table): Add R_NDS32_LSI.
(nds32_reloc_map): Likewise.
(nds32_elf_relax_flsi): New function.
(nds32_elf_relax_section): Support floating load/store relaxation.
* elf32-nds32.c (NDS32_GUARD_SEC_P, elf32_nds32_local_gp_offset):
New macro.
(struct elf_nds32_link_hash_entry): New `offset_to_gp' field.
(struct elf_nds32_obj_tdata): New `offset_to_gp' and `hdr_size' fields.
(elf32_nds32_allocate_local_sym_info, nds32_elf_relax_guard,
nds32_elf_is_target_special_symbol, nds32_elf_maybe_function_sym):
New functions.
(nds32_info_to_howto_rel): Add BFD_ASSERT.
(bfd_elf32_bfd_reloc_type_table_lookup, nds32_elf_link_hash_newfunc,
nds32_elf_link_hash_table_create, nds32_elf_relocate_section,
nds32_elf_relax_loadstore, nds32_elf_relax_lo12, nds32_relax_adjust_label,
bfd_elf32_nds32_set_target_option, nds32_fag_mark_relax): Updated.
(nds32_elf_final_sda_base): Improve it to find the better gp value.
(insert_nds32_elf_blank): Must consider `len' when inserting blanks.
* elf32-nds32.h (bfd_elf32_nds32_set_target_option): Update prototype.
(struct elf_nds32_link_hash_table): Add new variable `hyper_relax'.
* elf32-nds32.c (elf32_nds32_allocate_dynrelocs): New function.
(create_got_section): Likewise.
(allocate_dynrelocs, nds32_elf_size_dynamic_sections,
nds32_elf_relocate_section, nds32_elf_finish_dynamic_symbol): Updated.
(nds32_elf_check_relocs): Fix the issue that the shared library may
has TEXTREL entry in the dynamic section.
(nds32_elf_create_dynamic_sections): Enable to call readonly_dynrelocs
since the TEXTREL issue is fixed in the nds32_elf_check_relocs.
(nds32_elf_finish_dynamic_sections): Update and add DT_RELASZ
dynamic entry.
(calculate_offset): Remove the unused parameter `pic_ext_target' and
related codes.
All callers changed.
(elf_backend_dtrel_excludes_plt): Disable it temporarily since it
will cause some errors for our test cases.
* elf32-nds32.c (nds32_elf_merge_private_bfd_data): Allow to link the
generic object.
* reloc.c: Add TLS relocations.
* libbfd.h: Regenerated.
* bfd-in2.h: Regenerated.
* elf32-nds32.h (struct section_id_list_t): New.
(elf32_nds32_lookup_section_id, elf32_nds32_check_relax_group,
elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model):
New prototypes.
(elf32_nds32_compute_jump_table_size, elf32_nds32_local_tlsdesc_gotent):
New macro.
(nds32_insertion_sort, bfd_elf32_nds32_set_target_option,
elf_nds32_link_hash_table): Updated.
* elf32-nds32.c (enum elf_nds32_tls_type): New.
(struct elf32_nds32_relax_group_t, struct relax_group_list_t): New.
(elf32_nds32_add_dynreloc, patch_tls_desc_to_ie, get_tls_type,
fls, ones32, list_insert, list_insert_sibling, dump_chain,
elf32_nds32_check_relax_group, elf32_nds32_lookup_section_id,
elf32_nds32_unify_relax_group, nds32_elf_unify_tls_model): New functions.
(elf_nds32_obj_tdata): Add new fields.
(elf32_nds32_relax_group_ptr, nds32_elf_local_tlsdesc_gotent): New macros.
(nds32_elf_howto_table): Add TLS relocations.
(nds32_reloc_map): Likewise.
(nds32_elf_copy_indirect_symbol, nds32_elf_size_dynamic_sections,
nds32_elf_finish_dynamic_symbol, elf32_nds32_allocate_local_sym_info,
nds32_elf_relocate_section, bfd_elf32_nds32_set_target_option,
nds32_elf_check_relocs, allocate_dynrelocs): Updated.
(nds32_elf_relax_section): Call nds32_elf_unify_tls_model.
(dtpoff_base): Rename it to `gottpof' and then update it.
opcodes * nds32-asm.c (operand_fields): Remove the unused fields.
(nds32_opcodes): Remove the unused instructions.
* nds32-dis.c (nds32_ex9_info): Removed.
(nds32_parse_opcode): Updated.
(print_insn_nds32): Likewise.
* nds32-asm.c (config.h, stdlib.h, string.h): New includes.
(LEX_SET_FIELD, LEX_GET_FIELD): Update defines.
(nds32_asm_init, build_operand_hash_table, build_keyword_hash_table,
build_opcode_hash_table): New functions.
(nds32_keyword_table, nds32_keyword_count_table, nds32_field_table,
nds32_opcode_table): New.
(hw_ktabs): Declare it to a pointer rather than an array.
(build_hash_table): Removed.
* nds32-asm.h (enum): Add SYN_INPUT, SYN_OUTPUT, SYN_LOPT,
SYN_ROPT and upadte HW_GPR and HW_INT.
* nds32-dis.c (keywords): Remove const.
(match_field): New function.
(nds32_parse_opcode): Updated.
* disassemble.c (disassemble_init_for_target):
Add disassemble_init_nds32.
* nds32-dis.c (eum map_type): New.
(nds32_private_data): Likewise.
(get_mapping_symbol_type, is_mapping_symbol, nds32_symbol_is_valid,
nds32_add_opcode_hash_table, disassemble_init_nds32): New functions.
(print_insn_nds32): Updated.
* nds32-asm.c (parse_aext_reg): Add new parameter.
(parse_re, parse_re2, parse_aext_reg): Only reduced registers
are allowed to use.
All callers changed.
* nds32-asm.c (keyword_usr, keyword_sr): Updated.
(operand_fields): Add new fields.
(nds32_opcodes): Add new instructions.
(keyword_aridxi_mx): New keyword.
* nds32-asm.h (enum): Add NASM_ATTR_DSP_ISAEXT, HW_AEXT_ARIDXI_MX
and NASM_ATTR_ZOL.
(ALU2_1, ALU2_2, ALU2_3): New macros.
* nds32-dis.c (nds32_filter_unknown_insn): Updated.
Alan Modra [Thu, 20 Sep 2018 08:53:17 +0000 (18:23 +0930)]
PR23685, buffer overflow
PR 23685
* peXXigen.c (pe_print_edata): Correct export address table
overflow checks. Check dataoff against section size too.
Rainer Orth [Thu, 20 Sep 2018 09:23:27 +0000 (11:23 +0200)]
Provide pid_to_exec_file on Solaris (PR tdep/17903)
While looking through gdb.log, I found that two tests FAIL like this:
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x00400dc4 in ?? ()
(gdb) FAIL: gdb.base/attach.exp: attach2, with no file
The other is gdb.base/quit-live.exp. I've implemented the following
patch that fixes both failures, only then detecting that I'd previously
reported the issue as PR tdep/17903.
Tested on amd64-pc-solaris2.10 and amd64-pc-solaris2.11.
PR tdep/17903
* procfs.c (procfs_target): Declare pid_to_exec_file.
(procfs_target::pid_to_exec_file): New.
Rainer Orth [Thu, 20 Sep 2018 08:23:46 +0000 (10:23 +0200)]
Handle missing Solaris auxv entries
Currently, three tests FAIL on Solaris 11.4+ (amd64-pc-solaris2.11 and
sparcv9-sun-solaris2.11):
info auxv
[...]
2009 AT_SUN_HWCAP Machine-dependent CPU capability hints 0x3f5ff7
2023 ??? 0x0
0 AT_NULL End of vector 0x0
(gdb) WARNING: Unrecognized tag value: 2023 ??? 0x0
FAIL: gdb.base/auxv.exp: info auxv on live process
info auxv
4294969310 ??? 0x7fffbfffe410
9225589753816 ??? 0x7fffbfffe45c
[...]
WARNING: Unrecognized tag value:
4294969310 ??? 0x7fffbfffe410
WARNING: Unrecognized tag value:
9225589753816 ??? 0x7fffbfffe45c
WARNING: Unrecognized tag value:
140733193388037 ??? 0x6
[...]
2009 AT_SUN_HWCAP Machine-dependent CPU capability hints 0x3f5ff7
2023 ??? 0x0
0 AT_NULL End of vector 0x0
(gdb) WARNING: Unrecognized tag value: 2023 ??? 0x0
UNRESOLVED: gdb.base/auxv.exp: info auxv on native core dump
info auxv
[...]
2009 AT_SUN_HWCAP Machine-dependent CPU capability hints 0x3f5ff7
2023 ??? 0x0
0 AT_NULL End of vector 0x0
(gdb) WARNING: Unrecognized tag value: 2023 ??? 0x0
FAIL: gdb.base/auxv.exp: info auxv on gcore-created dump
The following patch fixes this by introducing the missing AT_SUN_*
values from Solaris 11.4+ <sys/auxv.h>. This lets the live and
gcore-created dump tests PASS.
I don't know yet what's the reason for those weird 'Unrecognized tag
value' warnings with native core dumps is; elfdump -n certainly doesn't
show them. However, native core dumps still need quite some work
(mostly in bfd) in this and other areas.
Tested on amd64-pc-solaris2.11.
gdb:
* auxv.c (default_print_auxv_entry): Reflect AT_SUN_CAP_HW1
renaming.
Handle AT_SUN_EMULATOR, AT_SUN_BRANDNAME, AT_SUN_BRAND_AUX1,
AT_SUN_BRAND_AUX2, AT_SUN_BRAND_AUX3, AT_SUN_CAP_HW2.
include:
* elf/common.h (AT_SUN_HWCAP): Rename to ...
(AT_SUN_CAP_HW1): ... this. Retain old name for backward
compatibility.
(AT_SUN_EMULATOR, AT_SUN_BRANDNAME, AT_SUN_BRAND_AUX1)
(AT_SUN_BRAND_AUX2, AT_SUN_BRAND_AUX3, AT_SUN_CAP_HW2): Define.
Rainer Orth [Thu, 20 Sep 2018 08:17:41 +0000 (10:17 +0200)]
Missed last ChangeLog entry.
Rainer Orth [Thu, 20 Sep 2018 08:10:07 +0000 (10:10 +0200)]
Fold i386-v4-nat.c into i386-sol2-nat.c
I've been carrying around the following patch for some time. I noticed
that both i386-sol2-nat.c and i386-v4-nat.c are Solaris-only now and it
seems confusing to carry both around.
So this patch merges i386-v4-nat.c into i386-sol2-nat.c, simplifying it
in a couple of places, like removing checks for macros that are always
defined.
Tested on 64-bit Solaris 11.5/x86 (amd64-pc-solaris2.11) and 32-bit
Solaris 11.3/x86 (i386-pc-solaris2.11) half a year ago.
* i386-v4-nat.c (regmap, supply_gregset, fill_gregset)
(supply_fpregset, fill_fpregset): Move ...
* i386-sol2-nat.c [PR_MODEL_NATIVE != PR_MODEL_LP64]: ... here.
Remove HAVE_GREGSET_T, HAVE_FPREGET_T guards.
Remove references to ioctl-based procfs.
Include <sys/reg.h>.
Remove PR_MODEL_NATIVE guards.
* configure.nat <sol2, i386> (NATDEPFILES): Remove i386-v4-nat.o.
* Makefile.in (ALLDEPFILES): Remove i386-v4-nat.c.
Alan Modra [Thu, 20 Sep 2018 05:59:17 +0000 (15:29 +0930)]
Bug 23686, two segment faults in nm
Fixes the bugs exposed by the testcases in the PR, plus two more bugs
I noticed when looking at _bfd_stab_section_find_nearest_line.
PR 23686
* dwarf2.c (read_section): Error when attempting to malloc
"(bfd_size_type) -1".
* syms.c (_bfd_stab_section_find_nearest_line): Bounds check
function_name. Bounds check reloc address. Formatting. Ensure
.stabstr zero terminated.
Sandra Loosemore [Thu, 20 Sep 2018 02:05:39 +0000 (19:05 -0700)]
Skip GDB tab-completion tests if no readline.
2018-09-18 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
* gdb.base/complete-empty.exp: Skip tab-completion tests if
no readline.
* gdb.base/utf8-identifiers.exp: Likewise.
* gdb.cp/cpcompletion.exp: Likewise.
* gdb.linespec/cpcompletion.exp: Likewise.
* gdb.linespec/cpls-abi-tag.exp: Likewise.
* gdb.linespec/cpls-ops.exp: Likewise.
GDB Administrator [Thu, 20 Sep 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Xavier Roirand [Wed, 22 Aug 2018 10:11:14 +0000 (12:11 +0200)]
Darwin: Handle unrelocated dyld.
On Darwin, debugging an helloworld program with GDB does
not work and ends with:
(gdb) set startup-with-shell off
(gdb) start
Temporary breakpoint 1 at 0x100000fb4: file /tmp/helloworld.c, line 1.
Starting program: /private/tmp/helloworld
[New Thread 0x2703 of process 18906]
[New Thread 0x2603 of process 18906]
[1]+ Stopped ./gdb/gdb /tmp/helloworld
When debugging with lldb, instead of having the STOP signal, we can
see that a breakpoint is not set to a proper location:
Warning:
Cannot insert breakpoint -1.
Cannot access memory at address 0xf726
Command aborted.
The inserted breakpoint is the one used when GDB has to stop the target
when a shared library is loaded or unloaded. The notifier address used
for adding the breakpoint is wrong thus the above failure.
This notifier address is an offset relative to dyld base address, so
the value calculation has to be updated to reflect this.
This was tested on High Sierra by trying to run a simple "hello world"
program.
gdb/ChangeLog:
PR gdb/20981:
* solib-darwin.c (darwin_get_dyld_bfd): New function.
(darwin_solib_get_all_image_info_addr_at_init): Update call.
(darwin_handle_solib_event): New function.
(darwin_solib_create_inferior_hook): Handle unrelocated dyld.
Change-Id: I7dde5008c9158f17b78dc89bd7f4bd8a12d4a6e1
John Baldwin [Wed, 19 Sep 2018 16:44:51 +0000 (09:44 -0700)]
Add missing spaces after inet_ntop invocations.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_print_sockaddr_in): Style fix.
(fbsd_print_sockaddr_in6): Likewise.
Richard Bunt [Wed, 19 Sep 2018 09:43:56 +0000 (10:43 +0100)]
Logical short circuiting with argument lists
When evaluating Fortran expressions such as the following:
print truth_table(1,1) .OR. truth_table(2,1)
where truth_table(1,1) evaluates to true, the debugger would report that
it could not perform substring operations on this type. This patch
addresses this issue.
Investigation revealed that EVAL_SKIP was not being handled correctly
for all types serviced by the OP_F77_UNDETERMINED_ARGLIST case in
evaluate_subexp_standard. While skipping an undetermined argument list
the type is resolved to be an integer (as this is what evaluate_subexp
returns when skipping) and so it was not possible to delegate to the
appropriate case (e.g. array, function call).
The solution implemented here updates OP_VAR_VALUE to return correct
type information when skipping. This way OP_F77_UNDETERMINED_ARGLIST
can delegate the skipping to the appropriate case or routine, which
should know how to skip/evaluate the type in question.
koenig.exp was updated to include a testcase which exercises the
modified skip logic in OP_VAR_VALUE, as it falls through from
OP_ADL_FUNC.
This patch has been tested for regressions with GCC 7.3 on aarch64,
ppc64le and x86_64.
gdb/ChangeLog:
* eval.c (skip_undetermined_arglist): Skip argument list helper.
(evaluate_subexp_standard): Return a dummy type when
honoring EVAL_SKIP in OP_VAR_VALUE and handle skipping in the
OP_F77_UNDETERMINED_ARGLIST case.
* expression.h (enum noside): Update comment.
gdb/testsuite/ChangeLog:
* gdb.cp/koenig.exp: Extend to test logical short circuiting.
* gdb.fortran/short-circuit-argument-list.exp: New file.
* gdb.fortran/short-circuit-argument-list.f90: New test.
Rainer Orth [Wed, 19 Sep 2018 09:29:19 +0000 (11:29 +0200)]
Handle 64-bit Solaris/x86 ld.so.1
The next patch from the solaris-userland github repo
https://github.com/oracle/solaris-userland/tree/master/components/gdb/patches
(007-solib-svr4.patch) is equally trivial, creating partity between
Solaris/SPARC and x86.
Tested on amd64-pc-solaris2.11.
2018-09-19 George Vasick <george.vasick@oracle.com>
* solib-svr4.c (svr4_same_1): Also handle amd64 ld.so.1.
Rainer Orth [Wed, 19 Sep 2018 09:21:32 +0000 (11:21 +0200)]
Fix /proc pathname sizes on Solaris
I'm slowly working my way through the gdb patches from the
solaris-userland repo
https://github.com/oracle/solaris-userland/tree/master/components/gdb/patches
This one (001-fix-proc-name-size.patch) should be obvious given the
patches' comment:
# In Solaris, PID_MAX is 999999 (6 digit pid).
# In Solaris, lwpid_t is an unsigned int, so theoretically the lwp id
# could be 10 digits.
Tested on i386-pc-solaris2.11.
2018-09-19 Stefan Teleman <stefan.teleman@oracle.com>
April Chin <april.chin@oracle.com>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* procfs.c (MAX_PROC_NAME_SIZE): Allow for 6-digit PID_MAX and
uint_t lwpid_t.
(create_procinfo): Print pids in /proc without leading zeros.
Alan Modra [Wed, 19 Sep 2018 06:37:44 +0000 (16:07 +0930)]
PR23648 testcase
PR 23648
* testsuite/ld-elf/pr23648.d,
* testsuite/ld-elf/pr23648.s,
* testsuite/ld-elf/pr23648.t: New test.
Alan Modra [Wed, 19 Sep 2018 03:52:43 +0000 (13:22 +0930)]
PR23648, Symbols based on MEMORY regions confuse --gc-sections
Running lang_do_memory_regions earlier seems a reasonable solution to
gaining better values for symbols prior to lang_gc_sections.
PR ld/23648
* ldlang.c (lang_process): Move lang_do_memory_regions earlier.
Comment on lang_do_assignments call.
* ldgram.y (origin_exp): Don't assign region->current.
Alan Modra [Wed, 19 Sep 2018 03:35:17 +0000 (13:05 +0930)]
Tweak map file output for pei386_auto_import
* ldmain.c (add_archive_element): Handle auto-inport symbols
when printing map.
Sandra Loosemore [Wed, 19 Sep 2018 03:57:07 +0000 (20:57 -0700)]
Add gcc_target_options hook for nios2.
2018-09-18 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_gcc_target_options): New.
(nios2_gdb_arch_init): Install new hook.
Simon Marchi [Wed, 19 Sep 2018 03:40:55 +0000 (23:40 -0400)]
Carry the gnulib getcwd backport as a patch
Commit
e2fc52e7457 ("Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB")
backported some changes from a future gnulib version to our import.
However, this means that every time someone wants to change our gnulib
import (e.g. add a module), they must make sure not to include that
backported change. It also means that someone running the
update-gnulib.sh script without changes will get some diffs and wonder
why.
Instead, I suggest we carry that backport as a patch applied by the
update-gnulib.sh script after running the import tool. It will make it
clear what backport or local modification we have and should make
running update-gnulib.sh give a reproducible result.
There is a hunk in the configure file in this patch, this is because the
commit that backported the getcwd bits didn't include the re-generated
configure.
Note: you'll need this patch as well to get deterministic results:
Generate aclocal-m4-deps.mk more deterministically and portably.
https://sourceware.org/ml/gdb-patches/2018-09/msg00643.html
gdb/ChangeLog:
* patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch:
New file.
* update-gnulib.sh: Apply patch.
* configure: Re-generate.
GDB Administrator [Wed, 19 Sep 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Tue, 18 Sep 2018 21:05:48 +0000 (14:05 -0700)]
Make the "info proc" documentation more consistent.
Remove "running" in a few places since "info proc" can be used with
core dumps as well as running processes on both Linux and FreeBSD.
Use "the specified process" in the description of most "info proc"
subcommands.
Use "additional information" instead of "/proc process information" in
the "info proc" description to more closely match the language in the
manual.
gdb/ChangeLog:
* infcmd.c (_initialize_infcmd): Remove "running" from "info proc"
description. Make "info proc" command descriptions more
consistent.
gdb/doc/ChangeLog:
* gdb.texinfo (info proc): Remove "running".
(info proc mappings): Replace "program" with "process".
John Baldwin [Tue, 18 Sep 2018 21:05:48 +0000 (14:05 -0700)]
Document the 'info proc files' command.
gdb/ChangeLog:
* NEWS: Mention 'info proc files' command.
gdb/doc/ChangeLog:
* gdb.texinfo (Process Information): Document "info proc files"
command.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Support 'info proc files' on live FreeBSD processes.
This walks the list of struct kinfo_file objects returned by a call to
kinfo_getfile outputting a description of each open file descriptor.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_nat_target::info_proc): List open file
descriptors for IP_FILES and IP_ALL.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Add support for 'info proc files' on FreeBSD core dumps.
Walk the list of struct kinfo_file objects in the
NT_FREEBSD_PROCSTAT_FILES core dump note outputting a description of
each open file descriptor. For sockets, the local and remote socket
addresses are displayed in place of the file name field. For UNIX
local domain sockets, only a single address is displayed since most
UNIX sockets only have one valid address and printing both pathnames
could be quite long. The output format was somewhat inspired by the
output of the "procstat -f" command on FreeBSD, but with a few less
details and some fields were condensed.
gdb/ChangeLog:
* fbsd-tdep.c (KF_FLAGS, KF_OFFSET, KF_VNODE_TYPE, KF_SOCK_DOMAIN)
(KF_SOCK_TYPE, KF_SOCK_PROTOCOL, KF_SA_LOCAL, KF_SA_PEER)
(KINFO_FILE_TYPE_SOCKET, KINFO_FILE_TYPE_PIPE)
(KINFO_FILE_TYPE_FIFO, KINFO_FILE_TYPE_KQUEUE)
(KINFO_FILE_TYPE_CRYPTO, KINFO_FILE_TYPE_MQUEUE)
(KINFO_FILE_TYPE_SHM, KINFO_FILE_TYPE_SEM, KINFO_FILE_TYPE_PTS)
(KINFO_FILE_TYPE_PROCDESC, KINFO_FILE_FD_TYPE_ROOT)
(KINFO_FILE_FD_TYPE_JAIL, KINFO_FILE_FD_TYPE_TRACE)
(KINFO_FILE_FD_TYPE_CTTY, KINFO_FILE_FLAG_READ)
(KINFO_FILE_FLAG_WRITE, KINFO_FILE_FLAG_APPEND)
(KINFO_FILE_FLAG_ASYNC, KINFO_FILE_FLAG_FSYNC)
(KINFO_FILE_FLAG_NONBLOCK, KINFO_FILE_FLAG_DIRECT)
(KINFO_FILE_FLAG_HASLOCK, KINFO_FILE_FLAG_EXEC)
(KINFO_FILE_VTYPE_VREG, KINFO_FILE_VTYPE_VDIR)
(KINFO_FILE_VTYPE_VCHR, KINFO_FILE_VTYPE_VLNK)
(KINFO_FILE_VTYPE_VSOCK, KINFO_FILE_VTYPE_VFIFO, FBSD_AF_UNIX)
(FBSD_AF_INET, FBSD_AF_INET6, FBSD_SOCK_STREAM, FBSD_SOCK_DGRAM)
(FBSD_SOCK_SEQPACKET, FBSD_IPPROTO_ICMP, FBSD_IPPROTO_TCP)
(FBSD_IPPROTO_UDP, FBSD_IPPROTO_SCTP): New defines.
(struct fbsd_sockaddr_in, struct fbsd_sockaddr_in6)
(struct fbsd_sockaddr_un): New types.
(fbsd_file_fd, fbsd_file_type, fbsd_file_flags, fbsd_ipproto)
(fbsd_print_sockaddr_in, fbsd_print_sockaddr_in6)
(fbsd_info_proc_files_header, fbsd_info_proc_files_entry)
(fbsd_core_info_proc_files): New functions.
(fbsd_core_info_proc): List open file descriptors for IP_FILES and
IP_ALL.
* fbsd-tdep.h (fbsd_info_proc_files_header)
(fbsd_info_proc_files_entry): New.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Add a new 'info proc files' subcommand of 'info proc'.
This command displays a list of open file descriptors.
gdb/ChangeLog:
* defs.h (enum info_proc_what) [IP_FILES]: New value.
* infcmd.c (info_proc_cmd_files): New function.
(_initialize_infcmd): Register 'info proc files' command.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Import gnulib's inet_ntop module.
An upcoming patch to fbsd-tdep.c uses inet_ntop to format IP addresses.
gdb/ChangeLog:
* gnulib/aclocal-m4-deps.mk: Re-generate.
* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.am: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
* gnulib/import/m4/gnulib-cache.m4: Re-generate.
* gnulib/import/m4/gnulib-comp.m4: Re-generate.
* gnulib/import/arpa_inet.in.h: New file.
* gnulib/import/inet_ntop.c: New file.
* gnulib/import/m4/arpa_inet_h.m4: New file.
* gnulib/import/m4/inet_ntop.m4: New file.
* gnulib/import/m4/netinet_in_h.m4: New file.
* gnulib/import/m4/socklen.m4: New file.
* gnulib/import/m4/sockpfaf.m4: New file.
* gnulib/import/m4/stdalign.m4: New file.
* gnulib/import/m4/sys_uio_h.m4: New file.
* gnulib/import/netinet_in.in.h: New file.
* gnulib/import/stdalign.in.h: New file.
* gnulib/import/sys_socket.c: New file.
* gnulib/import/sys_socket.in.h: New file.
* gnulib/import/sys_uio.in.h: New file.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add inet_ntop
module.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Generate aclocal-m4-deps.mk more deterministically and portably.
Sort the list of files generated by find to make the order of the
entries deterministic. When sorting, use explicit "C" collation. Use
an explicit tab character instead of '\t' as some sed implementations
treat '\t' as an escaped 't' instead of a tab.
gdb/ChangeLog:
* gnulib/aclocal-m4-deps.mk: New file.
* gnulib/update-gnulib.sh: Generate "aclocal-m4-deps.mk"
deterministically.
John Baldwin [Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)]
Use KF_PATH to verify the size of a struct kinfo_file.
fbsd_core_vnode_path needs to use the offset of the kf_path member of
struct kinfo_file as the minimum size of a struct kinfo_file object.
However, it was using KVE_PATH instead due to a copy and paste bug.
While here, fix another copy and paste bug in the error message for a
truncated kinfo_file object.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
KVE_PATH.
Sergio Durigan Junior [Tue, 18 Sep 2018 17:53:43 +0000 (13:53 -0400)]
Expect optional "arch=" when executing "-stack-list-frames" on gdb.arch/amd64-invalid-stack-top.exp
Another case of incomplete regexp. The problem is very similar to the
one happening with gdb.arch/amd64-invalid-stack-middle.exp.
The output when GDB is compiled with "--enable-targets" is:
(gdb) interpreter-exec mi "-stack-list-frames"
^done,stack=[frame={level="0",addr="0x00000000004005e7",func="func2",arch="i386:x86-64"}]
While the output when "--enable-targets" is not specified is:
(gdb) interpreter-exec mi "-stack-list-frames"
^done,stack=[frame={level="0",addr="0x00000000004005e7",func="func2"}]
The fix is, again, to extend the current regexp and expect for the
optional "arch=" part. With this patch, the test now passes on both
scenarios.
OK?
gdb/testsuite/ChangeLog:
2018-09-18 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/amd64-invalid-stack-top.exp: Expect optional
"arch=" keyword when executing "-stack-list-frames".
Sergio Durigan Junior [Tue, 18 Sep 2018 17:53:06 +0000 (13:53 -0400)]
Expect optional "arch=" when executing "-stack-list-frames" on gdb.arch/amd64-invalid-stack-middle.exp
While regression-testing GDB on Fedora Rawhide, I saw the following
output when running gdb.arch/amd64-invalid-stack-middle.exp's
"-stack-list-frames" test:
(gdb) interpreter-exec mi "-stack-list-frames"
^done,stack=[frame={level="0",addr="0x000000000040115a",func="breakpt",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/fedora/gdb/master/gdb-8.2.50.
20180917/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="27",arch="i386:x86-64"},frame={level="1",addr="0x000000000040116a",func="func5",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/fedora/gdb/master/gdb-8.2.50.
20180917/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="32",arch="i386:x86-64"},frame={level="2",addr="0x000000000040117a",func="func4",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/fedora/gdb/master/gdb-8.2.50.
20180917/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="38",arch="i386:x86-64"},frame={level="3",addr="0x000000000040118a",func="func3",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/fedora/gdb/master/gdb-8.2.50.
20180917/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="44",arch="i386:x86-64"}]
This test is currently failing on Rawhide. However, this output is
almost the same as I get on my local Fedora 28 machine (where the test
is passing):
(gdb) interpreter-exec mi "-stack-list-frames"
^done,stack=[frame={level="0",addr="0x00000000004005da",func="breakpt",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/work/src/git/binutils-gdb/binutils-gdb/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="27"},frame={level="1",addr="0x00000000004005ea",func="func5",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/work/src/git/binutils-gdb/binutils-gdb/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="32"},frame={level="2",addr="0x00000000004005fa",func="func4",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/work/src/git/binutils-gdb/binutils-gdb/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="38"},frame={level="3",addr="0x000000000040060a",func="func3",file="amd64-invalid-stack-middle.c",fullname="/home/sergio/work/src/git/binutils-gdb/binutils-gdb/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c",line="44"}]
With the exception that there's an "arch=" keyword on Fedora Rawhide's
version. This is because, on Rawhide, I've compiled GDB with
"--enable-targets=xyz,kqp,etc.", while locally I haven't.
This is easy to fix: we just have to extend the regexp and expect for
the optional "arch=" keyword there. It's what this patch does. With
it applied, the test now passes everywhere.
OK?
gdb/testsuite/ChangeLog:
2018-09-18 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/amd64-invalid-stack-middle.exp: Expect optional
"arch=" keyword when executing "-stack-list-frames".
Sergio Durigan Junior [Mon, 17 Sep 2018 21:29:50 +0000 (17:29 -0400)]
Expect for "@" when doing "complete break ada" on gdb.ada/complete.exp
Currently, gdb.ada/complete.exp's "complete break ada" test fails
because the regexp used to match the command's output doesn't expect
"@", but we have an output like:
...
complete break ada
break ada.assertions.assert
break ada.calendar.arithmetic.difference
break ada.calendar.arithmetic_operations.add
break ada.calendar.arithmetic_operations.add.cold
break ada.calendar.arithmetic_operations.add@plt
break ada.calendar.arithmetic_operations.difference
break ada.calendar.arithmetic_operations.difference@plt
...
This patch adds "@" to the regexp, unbreaking the test.
OK?
gdb/testsuite/ChangeLog:
2018-09-18 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.ada/complete.exp: Expect for "@" when doing "complete
break ada".
Tom Tromey [Sat, 15 Sep 2018 20:53:53 +0000 (14:53 -0600)]
Remove remaining cleanups from compile-object-load.c
This removes the remaining cleanups from compile-object-load.c.
gdb/ChangeLog
2018-09-18 Tom Tromey <tom@tromey.com>
* compile/compile-object-load.c (struct
link_hash_table_cleanup_data): Add constructor and destructor.
Use DISABLE_COPY_AND_ASSIGN.
(~link_hash_table_cleanup_data): Rename from
link_hash_table_free. Now a destructor.
(copy_sections): Use gdb::unique_xmalloc_ptr. Remove cleanups.
Tom Tromey [Sat, 15 Sep 2018 20:45:51 +0000 (14:45 -0600)]
Remove munmap_listp_free_cleanup
This removes munmap_listp_free_cleanup, replacing it with a
std::unique_ptr at one spot and an explicit delete in another. It
seemed simplest to completely change this data structure.
gdb/ChangeLog
2018-09-18 Tom Tromey <tom@tromey.com>
* compile/compile-object-run.c (do_module_cleanup): Use delete.
* compile/compile-object-load.c (struct munmap_list): Move to
header file.
(munmap_list::add): Rename from munmap_list_add; rewrite.
(munmap_list::~munmap_list): Rename from munmap_list_free.
(munmap_listp_free_cleanup): Remove.
(compile_object_load): Update.
* compile/compile-object-load.h (struct munmap_list): Move from
compile-object-load.c. Rewrite.
Nick Clifton [Tue, 18 Sep 2018 15:54:07 +0000 (16:54 +0100)]
Add a warning to the bfd library for when it encounters an ELF file with an invalid section size.
PR 23657
* elfcode.h (elf_swap_shdr_in): Generate a warning message if an
ELF section has contents and size larger than the file size.
Alan Hayward [Mon, 17 Sep 2018 14:28:53 +0000 (15:28 +0100)]
Aarch64 SVE: Fix stack smashing when calling functions
Using "call" on a function that passes arguments via float registers can cause
gdb to overflow buffers.
Ensure enough memory is reserved to hold a full FP register.
This fixes gdb.base/callfuncs.exp for Aarch64 SVE.
2018-09-18 Alan Hayward <alan.hayward@arm.com>
* aarch64-tdep.c (pass_in_v): Use register size.
(aarch64_extract_return_value): Likewise.
(aarch64_store_return_value): Likewise.
Tamar Christina [Tue, 18 Sep 2018 13:36:37 +0000 (14:36 +0100)]
Fix Aarch64 bug in warning filtering.
This fixes a small bug with the warning filtering code, which when a line has
generated a warning and a template decode error (due to the way templates are
resolved) which would not have been emitted and warnings are being suppressed
with -W it would erroneously emit the error.
I have no testcase for this because the only places we generate warnings during
encoding/decoding now is using msr/mrs and system registers. They don't have a
template that would trigger this.
However an upcoming patch series will have tests in it which would expose this bug.
gas/ChangeLog:
* config/tc-aarch64.c (output_operand_error_report): Apply filtering to
current instead of head message.
Rainer Orth [Tue, 18 Sep 2018 07:14:11 +0000 (09:14 +0200)]
Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build
gdb doesn't currently build on 64-bit Solaris 10:
/vol/src/gnu/gdb/hg/master/local/gdb/utils.c: In function ‘void dump_core()’:
/vol/src/gnu/gdb/hg/master/local/gdb/utils.c:223:55: error: narrowing conversion
of ‘-3’ from ‘long int’ to ‘rlim_t’ {aka ‘long unsigned int’} inside {
} [-Wnarrowing]
struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
^
/vol/src/gnu/gdb/hg/master/local/gdb/utils.c:223:55: error: narrowing conversion
of ‘-3’ from ‘long int’ to ‘rlim_t’ {aka ‘long unsigned int’} inside {
} [-Wnarrowing]
This was introduced by
2018-08-27 Tom Tromey <tom@tromey.com>
PR build/23087:
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Remove -Wno-narrowing.
and can be fixed by the following patch.
Solaris 11 isn't affected because there <sys/resource.h> has
#define RLIM_INFINITY ((rlim_t)-3l)
instead of
#define RLIM_INFINITY (-3l)
on Solaris 10.
Tested on amd64-pc-solaris2.10 and amd64-pc-solaris2.11.
* utils.c (dump_core) [HAVE_SETRLIMIT]: Cast RLIM_INFINITY to
rlim_t.
GDB Administrator [Tue, 18 Sep 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Mon, 17 Sep 2018 22:54:31 +0000 (00:54 +0200)]
[OBVIOUS] ChangeLog for obvious enable frame-filter help fix.
ChangeLog for
62b1765c90ddce54c04a97caac86425d50f2cc56
Philippe Waroquiers [Mon, 17 Sep 2018 22:14:26 +0000 (00:14 +0200)]
[OBVIOUS] enable frame-filter short help uses disable instead of enable
Without the patch:
(gdb) apropos able frame-filter
disable frame-filter -- GDB command to disable the specified frame-filter
enable frame-filter -- GDB command to disable the specified frame-filter
With the patch:
(gdb) apropos able frame-filter
disable frame-filter -- GDB command to disable the specified frame-filter
enable frame-filter -- GDB command to enable the specified frame-filter
Pushed as obvious
Tom Tromey [Sun, 16 Sep 2018 18:38:12 +0000 (12:38 -0600)]
Do not pass -DNDEBUG to Python compilations in development mode
The Python CFLAGS include -DNDEBUG. This was apparently done
intentionally -- setting the flags is done manually because, according
to a comment, python-config passes too many things to the compiler
(which is true).
Per PR python/20445, this patch changes configure so that -DNDEBUG is
only used by release builds. This probably doesn't have very much
effect in practice, but I did see that some Python headers use assert,
so perhaps it will give some safety.
Tested by rebuilding and re-running gdb.python/*.exp on x86-64 Fedora 28.
gdb/ChangeLog
2018-09-17 Tom Tromey <tom@tromey.com>
PR python/20445:
* configure: Rebuild.
* configure.ac: Conditionally use -DNDEBUG for Python.
Tom Tromey [Sun, 16 Sep 2018 15:52:09 +0000 (09:52 -0600)]
Check for gmp when checking for mpfr
There was a report on irc that the gdb check for mpfr failed when only
static libraries are available. The issue is that mpfr depends on
gmp, but this is not handled explicitly by gdb.
Ideally upstream would switch to pkg-config. Or even more ideally, we
would incorporate pkg-config into the compiler and not mess with any
of this.
Meanwhile, this changes gdb's configure to add gmp to the link line
when checking for mpfr.
gdb/ChangeLog
2018-09-17 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Use gmp as a library dependency when checking for
mpfr.
Pedro Alves [Mon, 17 Sep 2018 18:46:40 +0000 (19:46 +0100)]
[gdb/Python] Eliminate find_inferior_object
Commit
00431a78b28f ("Use thread_info and inferior pointers more
throughout") removed the declaration of find_inferior_object, but
missed removing the definition.
gdb/ChangeLog:
2018-09-17 Pedro Alves <palves@redhat.com>
* python/py-inferior.c (find_inferior_object): Delete.
Jim Wilson [Mon, 17 Sep 2018 18:43:08 +0000 (11:43 -0700)]
RISC-V: bge[u] should get higher priority than ble[u].
2018-09-17 Kito Cheng <kito@andestech.com>
gas/
* testsuite/gas/riscv/bge.d: New.
* testsuite/gas/riscv/bge.s: Likewise.
opcodes/
* riscv-opc.c (riscv_opcodes): Adjust the order of ble and
bleu.