Andrew Burgess [Tue, 28 Jul 2015 18:20:37 +0000 (19:20 +0100)]
ld: Extend options for altering orphan handling behaviour.
Replace the options --warn-orphan and --no-warn-orphan with a single
option --orphan-handling=MODE, where mode can be place, warn, error, and
discard.
Mode 'place' is the default, and is the current behaviour, placing the
orphan section into a suitable output section.
Mode 'warn' is the same as '--warn-orphan'. The orphan is also placed
using the same algorithm as for 'place'.
Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'.
Mode 'discard' assigns all output sections to the /DISCARD/ section.
ld/ChangeLog:
* ld.h (enum orphan_handling_enum): New.
(ld_config_type): Remove warn_orphan, add orphan_handling.
* ldemul.c (ldemul_place_orphan): Remove warning about orphan
sections.
* ldlang.c (ldlang_place_orphan): New function.
(lang_place_orphans): Call ldlang_place_orphan.
* ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and
OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING.
* lexsup.c (ld_options): Remove 'warn-orphan' and
'no-warn-orphan', add 'orphan-handling'.
(parse_args): Remove handling for OPTION_WARN_ORPHAN and
OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING.
* NEWS: Replace text about --warn-orphan with --orphan-handling.
* ld.texinfo (Options): Remove --warn-orphan entry and add
entry on --orphan-handling.
(Orphan Sections): Add reference to relevant command line options.
ld/testsuite/ChangeLog:
* ld-elf/elf.exp: Switch to rely on run_dump_test.
* ld-elf/orphan-5.l: Update expected output.
* ld-elf/orphan-5.d: New file.
* ld-elf/orphan-6.d: New file.
* ld-elf/orphan-6.l: New file.
* ld-elf/orphan-7.d: New file.
* ld-elf/orphan-7.map: New file.
* ld-elf/orphan-8.d: New file.
* ld-elf/orphan-8.map: New file.
Andrew Burgess [Mon, 31 Aug 2015 20:32:11 +0000 (21:32 +0100)]
gdb/tui: Remove casts of NULL during assignment.
In the following code:
struct symbol *wsym = (struct symbol *) NULL;
the cast of NULL is redundant, it adds noise, and is just one more thing
to change if the type of wsym ever changes. There are a relatively
small number of places in gdb where the above code pattern is used.
Usually the cast is removed like this:
struct symbol *wsym = NULL;
This commit updates all the places within the gdb/tui directory where we
cast NULL during assignment, removing the cast.
gdb/ChangeLog:
* tui/tui-data.c (win_with_focus): Remove cast of NULL pointer.
(tui_next_win): Likewise.
(tui_prev_win): Likewise.
(tui_partial_win_by_name): Likewise.
(tui_init_generic_part): Likewise.
(init_content_element): Likewise.
(tui_del_window): Likewise.
(tui_free_window): Likewise.
(tui_del_data_windows): Likewise.
(tui_free_data_content): Likewise.
* tui/tui-layout.c (make_source_or_disasm_window): Likewise.
* tui/tui-regs.c (tui_show_register_group): Likewise.
* tui/tui-win.c (tui_resize_all): Likewise.
(tui_set_focus): Likewise.
(tui_set_win_height): Likewise.
(make_invisible_and_set_new_height): Likewise.
* tui/tui-windata.c (tui_delete_data_content_windows): Likewise.
* tui/tui-wingeneral.c (make_visible): Likewise.
Andrew Burgess [Mon, 31 Aug 2015 20:25:37 +0000 (21:25 +0100)]
gdb/cli: Remove casts of NULL during assignment.
In the following code:
struct symbol *wsym = (struct symbol *) NULL;
the cast of NULL is redundant, it adds noise, and is just one more thing
to change if the type of wsym ever changes. There are a relatively
small number of places in gdb where the above code pattern is used.
Usually the cast is removed like this:
struct symbol *wsym = NULL;
This commit updates all the places within the gdb/cli directory where we
cast NULL during assignment, removing the cast.
gdb/ChangeLog:
* cli/cli-decode.c (find_cmd): Remove cast of NULL pointer.
Andrew Burgess [Mon, 31 Aug 2015 20:19:49 +0000 (21:19 +0100)]
gdb: Remove casts of NULL during assignment.
In the following code:
struct symbol *wsym = (struct symbol *) NULL;
the cast of NULL is redundant, it adds noise, and is just one more thing
to change if the type of wsym ever changes. There are a relatively
small number of places in gdb where the above code pattern is used.
Usually the cast is removed like this:
struct symbol *wsym = NULL;
This commit updates all the places within the gdb/ directory where we
cast NULL during assignment, removing the cast.
gdb/ChangeLog:
* c-valprint.c (print_unpacked_pointer): Remove cast of NULL
pointer.
* dbxread.c (dbx_end_psymtab): Likewise.
* gnu-nat.c (gnu_write_inferior): Likewise.
* mdebugread.c (cross_ref): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* xcoffread.c (xcoff_end_psymtab): Likewise.
Yao Qi [Fri, 4 Sep 2015 14:26:21 +0000 (15:26 +0100)]
Mention multi-arch debugging support in NEWS
gdb:
2015-09-04 Yao Qi <yao.qi@linaro.org>
* NEWS: Mention the aarch64 multi-arch debugging support.
GDB Administrator [Fri, 4 Sep 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Pierre-Marie de Rodat [Wed, 2 Sep 2015 16:18:15 +0000 (18:18 +0200)]
[Ada] Make string_char_type a true TYPE_CODE_CHAR type in Ada
Before this change, trying to call an overloaded function with at least
one character literal in argument would fail. For instance, given these
two functions:
function F (C : Character) return Integer is
begin
return Character'Pos (C);
end F;
function F (I : Integer) return Integer is
begin
return -I;
end F;
We would get the following GDB session:
(gdb) p f('A')
$1 = -65
(gdb) p f(1)
$1 = -1
This is wrong because the first call should select the first F function
and thus return 65.
The root problem is that ada-lang.c:ada_language_arch_info stores in
string_char_type a type whose code is TYPE_CODE_INT instead of
TYPE_CODE_CHAR. As a result, all parsed character literals are turned
into integer values and during overload matching, the TYPE_CODE_CHAR
formal rejects the TYPE_CODE_INT actual.
This change turns string_char_type into a true TYPE_CODE_CHAR type in
ada-lang.c so that we have instead the expected:
(gdb) p f('A')
$1 = 65
gdb/ChangeLog:
* ada-lang.c (ada_language_arch_info): Create a TYPE_CODE_CHAR
type instead of a TYPE_CODE_INT one for the string_char_type
and the ada_primitive_type_char types.
gdb/testsuite/ChangeLog:
* gdb.ada/funcall_char.exp: New testcase.
* gdb.ada/funcall_char/foo.adb: New file.
Tested on x86_64-linux, no regression.
Nick Clifton [Thu, 3 Sep 2015 15:49:18 +0000 (16:49 +0100)]
Fix typo in desription of linker script symbols.
(Source Code Reference): Fix off-by-one typo in example of how to
use linker script symbols in C source code.
Nick Clifton [Thu, 3 Sep 2015 15:15:49 +0000 (16:15 +0100)]
Fix seg-fault in readelf when scanniing a corrupt binary.
PR binutils/18879
* readelf.c (get_unwind_section_word): Check for negative offsets
and very small sections.
(dump_arm_unwind): Warn if the table offset is too large.
Yao Qi [Thu, 3 Sep 2015 13:01:49 +0000 (14:01 +0100)]
[aarch64] Check region OK for HW watchpoint in GDBserver
Nowadays, if user requests HW watchpoint to monitor a large memory area
or unaligned area, aarch64 GDB will split into multiple aligned areas,
and use multiple debugging registers to watch them. However, the
registers are not updated in a transaction way. GDBserver doesn't revert
updates in previous iterations if some debugging registers fail to update
due to some reason, like no free debugging registers available, in the
latter iteration. For example, if we have a char buf[34], and watch buf
in gdb,
(gdb) watch buf
Hardware watchpoint 2: buf
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (Thread 13466)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13466] for step-over
Sending packet: $m410838,22#35...Packet received: 00000000000000000000000000000000000000000000000000000000000000000000
infrun: skipping breakpoint: stepping past insn at: 0x400524
infrun: skipping breakpoint: stepping past insn at: 0x400524
Sending packet: $Z2,410838,22#80...Packet received: E01 <----- [1]
Packet Z2 (write-watchpoint) is supported
Sending packet: $Z0,
7fb7fe0a8c,4#43...Packet received: OK
Warning:
Could not insert hardware watchpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
GDB receives E01 for Z2 packet [1] but GDBserver updates the debugging
register status,
insert_point (addr=0x00410838, len=34, type=hw-write-watchpoint):
BREAKPOINTs:
BP0: addr=0x0, ctrl=0x00000000, ref.count=0
BP1: addr=0x0, ctrl=0x00000000, ref.count=0
BP2: addr=0x0, ctrl=0x00000000, ref.count=0
BP3: addr=0x0, ctrl=0x00000000, ref.count=0
BP4: addr=0x0, ctrl=0x00000000, ref.count=0
BP5: addr=0x0, ctrl=0x00000000, ref.count=0
WATCHPOINTs:
WP0: addr=0x410850, ctrl=0x00001ff5, ref.count=1
WP1: addr=0x410848, ctrl=0x00001ff5, ref.count=1
WP2: addr=0x410840, ctrl=0x00001ff5, ref.count=1
WP3: addr=0x410838, ctrl=0x00001ff5, ref.count=1
four debugging registers can not monitor 34-byte long area, so the last
iteration of updating debugging register state fails but previous
iterations succeed. This makes GDB think no HW watchpoint is inserted
but some debugging registers are used.
This problem was exposed by "watch buf" gdb.base/watchpoint.exp with
aarch64 GDBserver debugging arm 32-bit program. The buf is 30-byte long
but 4-byte aligned, and four debugging registers can't cover 34-byte
(extend 4 bytes to be 8-byte aligned) area. However, this problem
does exist on non-multi-arch debugging scenario as well.
This patch moves code in aarch64_linux_region_ok_for_hw_watchpoint to
aarch64_linux_region_ok_for_watchpoint in nat/aarch64-linux-hw-point.c.
Then, checks with aarch64_linux_region_ok_for_watchpoint, like what we
are doing in GDB. If the region is OK, call aarch64_handle_watchpoint.
Regression tested on aarch64 with both 64-bit program and 32-bit
program. Some fails in gdb.base/watchpoint.exp are fixed.
gdb:
2015-09-03 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_region_ok_for_hw_watchpoint):
Move code to aarch64_linux_region_ok_for_watchpoint. Call
aarch64_linux_region_ok_for_watchpoint.
* nat/aarch64-linux-hw-point.c (aarch64_linux_region_ok_for_watchpoint):
New function.
* nat/aarch64-linux-hw-point.h (aarch64_linux_region_ok_for_watchpoint):
Declare it.
gdb/gdbserver:
2015-09-03 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_insert_point): Call
aarch64_handle_watchpoint if aarch64_linux_region_ok_for_watchpoint
returns true.
Nick Clifton [Thu, 3 Sep 2015 11:55:57 +0000 (12:55 +0100)]
Fix a typo in the linker documentation: The COFF section .build-id should be .buildid.
H.J. Lu [Thu, 3 Sep 2015 11:13:21 +0000 (04:13 -0700)]
Remove convert_mov_to_lea
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove
convert_mov_to_lea.
H.J. Lu [Thu, 3 Sep 2015 11:03:13 +0000 (04:03 -0700)]
Add ifunc tests for call, jmp, add, test
* ld-ifunc/ifunc-21-i386.s: Add tests for call, jmp, add, test.
* ld-ifunc/ifunc-21-x86-64.s: Likewise.
* ld-ifunc/ifunc-22-i386.s: Likewise.
* ld-ifunc/ifunc-22-x86-64.s: Likewise.
* ld-ifunc/ifunc-21-i386.d: Updated.
* ld-ifunc/ifunc-21-x86-64.d: Likewise.
* ld-ifunc/ifunc-22-i386.d: Likewise.
* ld-ifunc/ifunc-22-x86-64.d: Likewise.
Patrick Palka [Sat, 29 Aug 2015 22:07:50 +0000 (18:07 -0400)]
Use gdbarch obstack to allocate the TYPE_NAME string in arch_type
Since the type whose name is being set is now being allocated on the
gdbarch obstack, we should allocate its TYPE_NAME on the obstack too.
This reduces the number of individual valgrind warnings for the command
"gdb gdb" from ~300 to ~150.
Tested on x86_64-unknown-linux-gnu.
gdb/ChangeLog:
* gdb_obstack.h (obstack_strdup): Declare.
* gdb_obstack.c (obstack_strdup): Define.
* gdbarch.sh (gdbarch_obstack_strdup): Declare and define.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbtypes.c (arch_type): Use gdbarch_obstack_strdup.
Patrick Palka [Sat, 29 Aug 2015 22:16:40 +0000 (18:16 -0400)]
Update documentation of function copy_type_recursive
Following commit
8f57eec2fb3 ("Use gdbarch obstack to allocate types in
alloc_type_arch") it is no longer the case that the type returned by
copy_type_recursive is allocated using malloc. Because the function
uses alloc_type_arch internally, the new type is now allocated on the
gdbarch associated with the type, and is thus owned by that gdbarch.
gdb/ChangeLog:
* gdbtypes.c (copy_type_recursive): Update documentation.
GDB Administrator [Thu, 3 Sep 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 2 Sep 2015 22:30:32 +0000 (15:30 -0700)]
Add 2 ifunc tests for i386 and x86-64
* ld-ifunc/ifunc-21-i386.d: Likewise.
* ld-ifunc/ifunc-21-i386.s: Likewise.
* ld-ifunc/ifunc-21-x86-64.d: Likewise.
* ld-ifunc/ifunc-21-x86-64.s: Likewise.
* ld-ifunc/ifunc-22-i386.d: Likewise.
* ld-ifunc/ifunc-22-i386.s: Likewise.
* ld-ifunc/ifunc-22-x86-64.d: Likewise.
* ld-ifunc/ifunc-22-x86-64.s: Likewise.
H.J. Lu [Wed, 2 Sep 2015 12:13:08 +0000 (05:13 -0700)]
Rename R_386_irelative to R_386_ext2
* elf32-i386.c (R_386_irelative): Renamed to ...
(R_386_ext2): This.
(R_386_vt_offset): Updated.
(elf_i386_rtype_to_howto): Likewise.
(elf_i386_relocate_section): Likewise.
H.J. Lu [Wed, 2 Sep 2015 11:14:21 +0000 (04:14 -0700)]
Turn IFUNC symbols from shared libraries into normal FUNC symbols
Turn IFUNC symbols from shared libraries into normal FUNC symbols when
we are resolving symbol references, instead of when we are writing out
the symbol table.
PR gold/18886
* resolve.cc (Symbol::override_base): Turn IFUNC symbols from
shared libraries into normal FUNC symbols.
* symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
symbols aren't from shared libraries.
Alan Modra [Wed, 2 Sep 2015 06:21:59 +0000 (15:51 +0930)]
[GOLD] ppc64 out-of-line register save/restore functions
Gold version of
a4b6fadd. Don't emit long branch or plt branch stubs
to save/restore functions. Copy them instead.
PR 18878
* powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
(Target_powerpc::Branch_info::make_stub): Determine whether long
branch stub is for save/restore function.
(Branch_stub_ent): Add save_res_, and extra parm to constructor.
(Stub_table): Add need_save_res_.
(Stub_table:clear_stubs): Clear need_save_res_.
(Stub_table:set_address_and_size): Add save/restore section size.
(Stub_table::add_long_branch_entry): Add save_res param. Set
need_save_res_, but don't add space for save/restore stubs.
(Stub_table::find_long_branch_entry): Return offset to local copy
of save/restore func.
(Stub_table::do_write): Don't output save/restore stubs. Instead
copy the save/restore functions.
(Output_data_save_res:contents): New accessor.
(Target_powerpc::define_save_restore_funcs): Set savres_section_.
Sergio Durigan Junior [Wed, 2 Sep 2015 04:46:43 +0000 (00:46 -0400)]
Initialize yet another variable to silence GCC warning from last-but-one commit
Yet another BuildBot e-mail, yet another breakage on RHEL-7.1 s390x
(which uses an older GCC). This time,
solib-svr4.c:solib_event_probe_action has the probe_argc variable,
which is now inside a TRY..CATCH and therefore needs to be
initialized. Pushed as obvious.
gdb/ChangeLog:
2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* solib-svr4.c (solib_event_probe_action): Initialize 'probe_argc'
as zero.
Sergio Durigan Junior [Wed, 2 Sep 2015 04:34:22 +0000 (00:34 -0400)]
Initialize variable and silence GCC warning from last commit
BuildBot e-mailed me to let me know that my last commit broke GDB on
RHEL-7.1 s390x. On solib-svr4.c:svr4_handle_solib_event, 'val' now
needs to be initialized as NULL because it is inside a TRY..CATCH
block. This patch does that. Pushed as obvious.
gdb/ChangeLog:
2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* solib-svr4.c (svr4_handle_solib_event): Initialize 'val' as NULL
Sergio Durigan Junior [Fri, 21 Aug 2015 22:28:07 +0000 (18:28 -0400)]
Catching errors on probes-based dynamic linker interface
This patch is intended to make the interaction between the
probes-based dynamic linker interface and the SystemTap SDT probe code
on GDB more robust. It does that by wrapping the calls to the probe
API with TRY...CATCH'es, so that any exception thrown will be caught
and handled properly.
The idea for this patch came from
<https://bugzilla.redhat.com/show_bug.cgi?id=
1196181>, which is a bug
initially filed against Fedora GDB (but now under Fedora GLIBC). This
bug happens on armhfp (although it could happen on other targets as
well), and is triggered because GCC generates a strange argument for
one of the probes used by GDB in the dynamic linker interface. As can
be seen in the bug, this argument is "-4@.L1052".
I don't want to discuss the reasons for this argument to be there
(this discussion belongs to the bug, or to another thread), but GDB
could definitely do a better error handling here. Currently, one sees
the following message when there is an error in the probes-based
dynamic linker interface:
(gdb) run
Starting program: /bin/inferior
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.
Cannot parse expression `.L976 4@r4'.
(gdb)
Which means that one needs to explicitly issue a "continue" command to
make GDB continue running the inferior, even though this error is not
fatal and GDB will fallback to the old interface automatically.
This is where this patch helps: it makes GDB still print the necessary
warnings or error messages, but it *also* does not stop the inferior
unnecessarily.
I have tested this patch on the systems where this error happens, but
I could not come up with a way to create a testcase for it.
Nevertheless, it should be straightforward to see that this patch does
improve the current situation.
gdb/ChangeLog:
2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* solib-svr4.c (solib_event_probe_action): Call
get_probe_argument_count using TRY...CATCH.
(svr4_handle_solib_event): Likewise, for evaluate_probe_argument.
Sergio Durigan Junior [Fri, 21 Aug 2015 22:13:46 +0000 (18:13 -0400)]
Improve error reporting when handling SystemTap SDT probes
This patch improves the error reporting when handling SystemTap SDT
probes. "Handling", in this case, mostly means "parsing".
On gdb/probe.h, only trivial changes on functions' comments in order
to explicitly mention that some of them can throw exceptions. This is
just to make the API a bit more clear.
On gdb/stap-probe.c, I have s/internal_error/error/ on two functions
that are responsible for parsing specific bits of the probes'
arguments: stap_get_opcode and stap_get_expected_argument_type. It is
not correct to call internal_error on such situations because it is
not really GDB's fault if the probes have malformed arguments. I also
improved the error reported on stap_get_expected_argument_type by also
including the probe name on it.
Aside from that, and perhaps most importantly, I added a check on
stap_get_arg to make sure that we don't try to extract an argument
from a probe that has no arguments. This check issues an
internal_error, because it really means that GDB is doing something it
shouldn't.
Although it can be considered almost trivial, and despite the fact
that I am the maintainer for this part of the code, I am posting this
patch for review. I will wait a few days, and if nobody has anything
to say, I will go ahead and push it.
gdb/ChangeLog:
2015-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* probe.h (struct probe_ops) <get_probe_argument_count,
evaluate_probe_argument, enable_probe, disable_probe>: Mention in
the comment that the function can throw an exception.
(get_probe_argument_count): Likewise.
(evaluate_probe_argument): Likewise.
* stap-probe.c (stap_get_opcode): Call error instead of
internal_error.
(stap_get_expected_argument_type): Likewise. Add argument
'probe'. Improve error message by mentioning the probe's name.
(stap_parse_probe_arguments): Adjust call to
stap_get_expected_argument_type.
(stap_get_arg): Add comment. Assert that 'probe->args_parsed' is
not zero. Call internal_error if GDB requests an argument but the
probe has no arguments.
GDB Administrator [Wed, 2 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Pierre-Marie de Rodat [Mon, 31 Aug 2015 14:04:07 +0000 (16:04 +0200)]
[Ada] Fix completion for multiple function matches
Before this change, trying to complete an expression ending with an
ambiguous function name (i.e. for which there are multiple matches)
would display a menu with a prompt for the user to pick one. For
instance:
(gdb) p func<tab>Multiple matches for func
[0] cancel
[1] pack2.func at pack2.adb:5
[2] pack.func at pack.adb:5
>
This is not user friendly and actually triggered a segmentation fault
after the user did pick one. It is not clear whether the segmentation
fault needs a separate fix, but this is the only known case which
exhibits it at the moment, and this case must be fixed itself.
The problem lies in ada-lang.c (ada_resolve_function): when we got
multiple matches, we should not display the menu if we are in completion
mode. This patch adjusts the corresponding condition accordingly.
gdb/ChangeLog:
* ada-lang.c (ada_resolve_function): Do not ask the user what
match to use when in completion mode.
gdb/testsuite/ChangeLog:
* gdb.ada/complete.exp: Add "pck.ambiguous_func" to the relevant
expected outputs. Add two testcases for completing ambiguous
functions.
* gdb.ada/complete/aux_pck.adb: New file.
* gdb.ada/complete/aux_pck.ads: New file.
* gdb.ada/complete/foo.adb: Pull Aux_Pck and call the two
Ambiguous_Func functions.
* gdb.ada/complete/pck.ads: Add an Ambiguous_Func function.
* gdb.ada/complete/pck.adb: Likewise.
Tested on x86_64-linux, no regression.
H.J. Lu [Tue, 1 Sep 2015 12:06:16 +0000 (05:06 -0700)]
Skip PLT for function pointer initialization
We use its PLT entry to initialize function pointer at run-time. If
there is no other usage for the PLT entry, we can generate run-time
function pointer relocations in read-write section, which can be
resolved by dynamic linker, to initialize function pointers. It avoids
the extra indirect branch overhead in PLT.
bfd/
PR ld/18900
* elf32-i386.c (elf_i386_link_hash_entry): Add
func_pointer_refcount.
(elf_i386_link_hash_newfunc): Clear func_pointer_refcount.
(elf_i386_get_local_sym_hash): Likewise.
(elf_i386_copy_indirect_symbol): Also copy
func_pointer_refcount.
(elf_i386_check_relocs): Increment func_pointer_refcount.
(elf_i386_gc_sweep_hook): Decrement func_pointer_refcount.
(elf_i386_allocate_dynrelocs): Don't create the PLT entry if
there are only function pointer relocations which can be
resolved at run-time. Keep dynanamic relocations for run-time
function pointer initialization.
(elf_i386_relocate_section): Copy dynamic function pointer
relocations.
* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
func_pointer_refcount.
(elf_x86_64_link_hash_newfunc): Clear func_pointer_refcount.
(elf_x86_64_get_local_sym_hash): Likewise.
(elf_x86_64_copy_indirect_symbol): Also copy
func_pointer_refcount.
(elf_x86_64_check_relocs): Increment func_pointer_refcount.
(elf_x86_64_gc_sweep_hook): Decrement func_pointer_refcount.
(elf_x86_64_allocate_dynrelocs): Don't create the PLT entry if
there are only function pointer relocations which can be
resolved at run-time. Keep dynanamic relocations for run-time
function pointer initialization.
(elf_x86_64_relocate_section): Copy dynamic function pointer
relocations.
ld/testsuite/
PR ld/18900
* ld-i386/i386.exp: Run tests for PR ld/18900.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pr18900.out: New file.
* ld-i386/pr18900a.c: Likewise.
* ld-i386/pr18900a.c: Likewise.
* ld-i386/pr18900a.rd: Likewise.
* ld-i386/pr18900b.c: Likewise.
* ld-i386/pr18900b.rd: Likewise.
* ld-i386/pr18900c.c: Likewise.
* ld-x86-64/pr18900.out: Likewise.
* ld-x86-64/pr18900a.c: Likewise.
* ld-x86-64/pr18900a.rd: Likewise.
* ld-x86-64/pr18900b.c: Likewise.
* ld-x86-64/pr18900b.rd: Likewise.
* ld-x86-64/pr18900c.c: Likewise.
* ld-x86-64/mpx3.dd: Updated.
Alan Modra [Tue, 1 Sep 2015 07:58:13 +0000 (17:28 +0930)]
Wrong function reported for linker error message
OPD lookup goes awry when .opd has been shuffled to remove unused
functions.
* elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value
if .opd section has been edited.
Alan Modra [Mon, 31 Aug 2015 23:26:22 +0000 (08:56 +0930)]
ppc64 out-of-line register save/restore functions
Don't emit long branch or plt branch stubs to save/restore functions.
Copy them instead. The problem is that plt branch stubs currently
trash r12, one of the parameters to some of the save/restore
functions, and there is no free register available to use instead of
r12.
6f20ed8a is prerequisite for this patch.
PR 18878
* elf64-ppc.c (ARRAY_SIZE): Define. Use throughout.
(enum ppc_stub_type): Add ppc_stub_save_res.
(struct map_stub): Add "next" and "needs_save_res".
(struct ppc_link_hash_entry): Add "save_res" flag.
(struct ppc_link_hash_table): Add "group".
(sfpr_define): Add stub_sec param. Define symbol in stub_sec if
stub_sec is non-null. Set "save_res".
(save_res_funcs): Make file scope, rename from funcs. Adjust uses.
(ppc64_elf_adjust_dynamic_symbol): Prohibit plt call to save_res syms.
(ppc_build_one_stub): Handle ppc_stub_save_res.
(ppc_size_one_stub): Set stub type to ppc_size_one_stub on finding
stub for linker defined save_res sym.
(group_sections): Init new fields of struct map_stub.
(ppc64_elf_size_stubs): Reserve space for save/restore func copy.
(ppc64_elf_build_stubs): Copy save/restore funcs to groups. Emit
alias syms too.
(ppc64_elf_relocate_section): Set destination for ppc_stub_save_res.
GDB Administrator [Tue, 1 Sep 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Mon, 31 Aug 2015 08:25:14 +0000 (17:55 +0930)]
Optimise PowerPC64 r2 adjusting stubs
Sometimes these stubs don't need to change the low 16-bits of r2, so in
that case omit a useless addi r2,r2,0 insn. Also, change the get_r2off
error return from 0 to -1 since 0 is a valid return for ELFv2 -R objects.
* elf64-ppc.c (get_r2off): Return -1 on error.
(ppc_build_one_stub): Adjust for get_r2off change. Don't emit
addi r2,r2,0 on r2off stubs when the low 16-bit delta is zero.
(ppc_size_one_stub): Corresponding size changes for r2off stubs.
Add condition in test for -R objects.
Alan Modra [Mon, 31 Aug 2015 08:20:33 +0000 (17:50 +0930)]
ppc64 section group handling
Two organizational changes to the array of additional info kept for
sections.
1) Move group info into a per-group allocated struct, in preparation
for future changes that need per-group accounting.
2) Expand the array to include output sections, which simplifies
sizing and removes the need for a separate output section array.
* section.c (section_id): Make file scope.
(bfd_get_next_section_id): New function.
* elf64-ppc.c (struct map_stub): Remove toc_off field. Move decl.
(struct ppc_stub_hash_entry): Delete stub_sec and id_sec. Add
group. Update all uses.
(struct ppc_link_hash_table): Delete top_id, top_index, and
input_list. Add sec_info_arr_size. Rename stub_group to
sec_info, and make group info indirect. Update stub_group refs
throughout file.
(ppc_add_stub): Don't look for stub_sec on link_sec stub_group
entry.
(ppc_build_one_stub): Delete FIXME.
(ppc64_elf_setup_section_lists): Size htab->sec_info for all
sections, not just input sections. Don't create htab->input_list.
(ppc64_elf_next_input_section): Update to use sec_info union as
list pointer.
(PREV_SEC): Delete.
(group_sections): Pass "info" param rather than "htab". Iterate
over output sections rather than input_list. Use sec_info union
as list pointers. Alloc atruct map_stub, and return fail status.
* bfd-in2.h: Regenerate.
Andrew Burgess [Sun, 30 Aug 2015 10:14:58 +0000 (11:14 +0100)]
gdb/tui: Make local variable const.
Small clean up to make a local variable const and remove a cast of NULL.
gdb/ChangeLog:
* tui/tui-data.c (tui_win_name): Make local variable const, remove
cast of NULL.
Max Filippov [Sat, 30 May 2015 10:00:32 +0000 (13:00 +0300)]
xtensa: initialize call_abi in xtensa_tdep
Use XSHAL_ABI value provided by xtensa-config.h to correctly initialize
xtensa_tdep.call_abi
This fixes calls to functions from GDB that otherwise fail with the
following assertion in call0 configuration:
gdb/regcache.c:602: internal-error: regcache_raw_read: Assertion
`regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
2015-08-31 Max Filippov <jcmvbkbc@gmail.com>
gdb/
* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Initialize
call_abi using XSHAL_ABI macro.
Alan Modra [Mon, 31 Aug 2015 06:33:42 +0000 (16:03 +0930)]
More "Make asection->id and asection->index unsigned"
Fixes regressions introduced by
7292b3ac.
* elflink.c (elf_sort_symbol): Use correctly sized type for
calculating signed section->id difference.
(elf_link_add_object_symbols): Likewise.
* pef.c (bfd_pef_scan_start_address): Warning fix.
* vms-alpha.c (vms_new_section_hook): Likewise.
Alan Modra [Mon, 31 Aug 2015 03:31:59 +0000 (13:01 +0930)]
NDS32 build fixes
* elf32-nds32.c (nds32_convert_32_to_16_alu1): Warning fix.
(find_relocs_at_address_addr): Make "reloc_type" an enum.
(nds32_elf_relax_delete_blanks): Warning fix.
(nds32_elf_relax_loadstore): Correct loop bound.
Alan Modra [Mon, 31 Aug 2015 03:23:36 +0000 (12:53 +0930)]
Regen intl/configure
* configure: Regenerate.
Alan Modra [Sun, 30 Aug 2015 23:02:29 +0000 (08:32 +0930)]
Make asection->id and asection->index unsigned
These int vars are really unsigned, so make them so.
* section.c (struct bfd_section): Make "id" and "index" unsigned.
* coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust local var to suit.
* elf.c (elf_map_symbols): Likewise.
* elf64-ppc.c (sym_exists_at): Make "id" param unsigned.
(struct ppc_link_hash_table): Make "top_id" and "top_index" unsigned.
(ppc64_elf_setup_section_lists): Ditto for local vars.
* elf32-arm.c: Similarly to elf64-ppc.c.
* elf32-avr.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-metag.c: Likewise.
* elf32-nios2.c: Likewise.
* elfnn-aarch64.c: Likewise.
* simple.c (struct saved_offsets): Make "section_count" unsigned.
* bfd-in2.h: Regenerate.
GDB Administrator [Mon, 31 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Sun, 30 Aug 2015 00:10:58 +0000 (17:10 -0700)]
symtab.h (struct symbol): Tweak comment.
gdb/ChangeLog:
* symtab.h (struct symbol): Tweak comment.
GDB Administrator [Sun, 30 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Patrick Palka [Sat, 29 Aug 2015 22:03:37 +0000 (18:03 -0400)]
Revert "Use gdbarch obstack to allocate the TYPE_NAME string in arch_type"
This patch manually modified the autogenerated files gdbarch.[ch] instead of
going through gdbarch.sh.
This reverts commit
aa78b3b28aeff4bb9977a313f5a8002d920b34c5.
Patrick Palka [Mon, 29 Jun 2015 14:45:47 +0000 (10:45 -0400)]
Use gdbarch obstack to allocate the TYPE_NAME string in arch_type
Since the type whose name is being set is now being allocated on the
gdbarch obstack, we should allocate its TYPE_NAME on the obstack too.
This reduces the number of individual valgrind warnings for the command
"gdb gdb" from ~300 to ~150.
Tested on x86_64-unknown-linux-gnu.
gdb/ChangeLog:
* gdbarch.h (gdbarch_obstack_strdup): Declare.
* gdbarch.c (gdbarch_obstack_strdup): Define.
* gdbtypes.c (arch_type): Use it.
Patrick Palka [Mon, 29 Jun 2015 14:39:26 +0000 (10:39 -0400)]
Use gdbarch obstack to allocate types in alloc_type_arch
For the command "gdb gdb" valgrind currently reports 100s of individual
memory leaks, 500 of which originate solely out of the function
alloc_type_arch. This function allocates a "struct type" associated
with the given gdbarch using malloc but apparently the types allocated
by this function are never freed.
This patch fixes these leaks by making the function alloc_type_arch
allocate these gdbarch-associated types on the gdbarch obstack instead
of on the general heap. Since, from what I can tell, the types
allocated by this function are all fundamental "wired-in" types, such
types would not benefit from more granular memory management anyway.
They would likely live as long as the gdbarch is alive so allocating
them on the gdbarch obstack makes sense.
With this patch, the number of individual vargrind warnings emitted for
the command "gdb gdb" drops from ~800 to ~300.
Tested on x86_64-unknown-linux-gnu.
gdb/ChangeLog:
* gdbtypes.c (alloc_type_arch): Allocate the type on the given
gdbarch obstack instead of on the heap. Update commentary
accordingly.
GDB Administrator [Sat, 29 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Fri, 28 Aug 2015 21:40:54 +0000 (17:40 -0400)]
Document the GDB 7.10 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 7.10 released.
Simon Marchi [Fri, 28 Aug 2015 19:35:47 +0000 (15:35 -0400)]
Update NEWS entry about non-8-bits addressable memory
Ulrich Weigand [Fri, 28 Aug 2015 17:04:56 +0000 (19:04 +0200)]
Revert: solib_global_lookup: Fetch arch from objfile.
solib_ops are installed as a property of the inferior gdbarch,
so they need to be systematically looked up via that architecture,
not some objfile architecture.
ChangeLog:
Revert:
2014-11-06 Doug Evans <xdje42@gmail.com>
* solib.c (solib_global_lookup): Fetch arch from objfile,
not target_gdbarch.
Ulrich Weigand [Fri, 28 Aug 2015 17:04:12 +0000 (19:04 +0200)]
Fix incorrect ChangeLog dates.
H.J. Lu [Fri, 28 Aug 2015 15:34:44 +0000 (08:34 -0700)]
Also install readelf into tooldir/bin directory
* Makefile.am (TOOL_PROGS): Add readelf.
* Makefile.in: Regenerated.
GDB Administrator [Fri, 28 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 27 Aug 2015 17:47:44 +0000 (13:47 -0400)]
Fix ChangeLog entries starting with "Likewise"
The first lines of these ChangeLog entries are "Likewise"... it doesn't
make much sense.
Ulrich Weigand [Thu, 27 Aug 2015 17:31:04 +0000 (19:31 +0200)]
[Cell/B.E.] Fix wrong relocation for TLS variable offset
When debugging Cell/B.E. code, the cross-architecture frame unwinding
works by accessing data structures refered to by a thread-local variable
in the inferior. While accessing this variable via minimal symbol,
code would use BMSYMBOL_VALUE_ADDRESS to determine the offset of the
variable in the thread-local storage block.
This is incorrect, since it adds any relocation offset of the shared
library defining the TLS variable. That offset would be OK when
accessing the initial copy present in the .tbss section, but it must
not be applied to the offset of the variable in the TLS block at
runtime. Depending on whether or not the libspe2.so library was
prelinked, access to the variable would fail due to the incorrectly
relocated offset.
ChangeLog:
* ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Do not
attempt to relocate a TLS variable offset.
Ulrich Weigand [Thu, 27 Aug 2015 17:27:40 +0000 (19:27 +0200)]
[Cell/B.E.] Make parse_spufs_run more robust
With recent changes to inferior handling, parse_spufs_run needs to be
more careful in assumptions it makes. In particular, this patch:
- Bails out early if the current inferior has not yet been registered
(e.g. during fork procession) to avoid assertion failures in register
cache code.
- Sets inferior_ptid to the current ptid while calling target_read_memory
to make sure the correct process is accessed if parse_spufs_run is
called early when inferior_ptid has not yet been switched by the caller.
ChangeLog:
* spu-multiarch.c (parse_spufs_run): Bail out if inferior is not
registered yet. Set inferior_ptid while calling target_read_memory.
Ulrich Weigand [Thu, 27 Aug 2015 17:20:29 +0000 (19:20 +0200)]
Detect SW breakpoints in Cell/B.E. combined debugging
The Linux target and gdbserver now check the siginfo si_code
reported on a SIGTRAP to detect whether the trap indicates
a software breakpoint was hit.
Unfortunately, on Cell/B.E., the kernel uses an si_code value
of TRAP_BRKPT when a SW breakpoint was hit in PowerPC code,
but a si_code value of SI_KERNEL when a SW breakpoint was
hit in SPU code.
This patch updates Linux target and gdbserver to accept both
si_code values to indicate SW breakpoint on PowerPC.
ChangeLog:
* nat/linux-ptrace.h (GDB_ARCH_TRAP_BRKPT): Replace by ...
(GDB_ARCH_IS_TRAP_BRKPT): ... this. Add __powerpc__ case.
* linux-nat.c (check_stopped_by_breakpoint): Use
GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.
gdbserver/ChangeLog:
* linux-low.c (check_stopped_by_breakpoint): Use
GDB_ARCH_IS_TRAP_BRKPT instead of GDB_ARCH_TRAP_BRKPT.
Ulrich Weigand [Thu, 27 Aug 2015 17:12:49 +0000 (19:12 +0200)]
Fix assertion failure in linux-thread-db
Since we are no longer using thread events by default in linux-thread-db,
the find_new_threads_once routine contains an assertion that it should
never be called on a live inferior unless using thread events:
gdb_assert (!target_has_execution || thread_db_use_events ());
However, there is a code path from thread_db_get_thread_local_address
that will in fact call find_new_threads_once in some scenarios. In
particular, this is currently always triggered when starting up any
Cell/B.E. combined exeuctable.
To fix this, this patch removes the call to thread_db_find_new_threads_1
when the current thread was not yet detected. In its place, we now just
call thread_from_lwp to detect this one thread if necessary.
ChangeLog:
* linux-thread-db.c (thread_db_get_thread_local_address): If the
thread was not yet discovered, use thread_from_lwp instead of
calling thread_db_find_new_threads_1.
Ulrich Weigand [Thu, 27 Aug 2015 17:06:03 +0000 (19:06 +0200)]
Report UNRESOLVED on failures while detecting Cell/B.E.
The gdb.cell testcases use the predicate skip_cell_tests defined in
lib/cell.exp to determine whether Cell/B.E. test cases ought to be
run. This tests verifies that we have a toolchain that supports
generating combined Cell/B.E. binaries, and that the target machine
actually is a Cell/B.E.
In order to do so, a small test program is built and run (under the
debugger). Any failure is taken as a sign that we don't have a
Cell/B.E. machine and the tests are to be skipped.
This has the unfortunate effect that a serious bug in GDB that causes
internal compiler errors even on the trivial test program does not
lead to any failures in the testsuite, since now all gdb.cell test
are simply skipped.
This patch changes skip_cell_tests to at least report UNRESOLVED
in cases where execution of the test program fails in unexpected
ways.
testsuite/ChangeLog:
* lib/cell.exp (skip_cell_tests): Report UNRESOLVED on unexpected
failures to run the test program under GDB.
Alan Modra [Thu, 27 Aug 2015 06:35:54 +0000 (16:05 +0930)]
Add reloc sort test
* ld-powerpc/relocsort.s, * ld-powerpc/relocsort.d: New test.
* ld-powerpc/powerpc.exp: Run it.
Alan Modra [Thu, 27 Aug 2015 13:20:38 +0000 (22:50 +0930)]
More fallout from "Allow symbol and label names to be enclosed in double quotes"
Some of the TC_START_LABEL implementations need to adjust the end of
the symbol, when a colon doesn't mean a label definition. That means
they need access to nul_char both the restore the NUL location (it may
be a quote rather than a colon) and to store the new nul_char. Others
need adjusting to step over a potential trailing quote.
PR gas/18581
* config/tc-aarch64.h (TC_START_LABEL): Redefine.
* config/tc-arm.c (tc_start_label_without_colon): Delete params.
Use input_line_pointer directly.
* config/tc-arm.h (TC_START_LABEL): Redefine.
(TC_START_LABEL_WITHOUT_COLON): Redefine.
(tc_start_label_without_colon): Update prototype.
* config/tc-bfin.c (bfin_start_label): Delete ptr param. Check
for NUL instead.
* config/tc-bfin.h (bfin_start_label): Update prototype.
(TC_START_LABEL): Redefine.
* config/tc-d30v.h (TC_START_LABEL): Redefine.
* config/tc-fr30.c (restore_colon): Rewrite.
(fr30_is_colon_insn): Add nul_char param. Return int. Bump
i_l_p over quote. Update restore_colon calls.
* config/tc-fr30.h (TC_START_LABEL): Redefine.
(fr30_is_colon_insn): Update prototype.
* config/tc-m32c.c (restore_colon, m32c_is_colon_insn): As above.
* config/tc-m32c.h (TC_START_LABEL): Redefine.
(m32c_is_colon_insn): Update prototype.
* config/tc-m32r.h (TC_START_LABEL): Redefine.
* config/tc-mep.h (TC_START_LABEL): Redefine.
* config/tc-nds32.h (TC_START_LABEL): Redefine.
* config/tc-tic54x.c (tic54x_start_label): Replace params with
nul_char and next_char. Step over trailing quote.
* config/tc-tic54x.h (TC_START_LABEL_WITHOUT_COLON): Redefine.
(tic54x_start_label): Update prototype.
* read.c (TC_START_LABEL): Redefine. Update invocation.
(TC_START_LABEL_WITHOUT_COLON): Update invocation.
* config/tc-nios2.c (s_nios2_set): Save initial input_line_pointer
and restore if calling s_set. Don't restore delim again.
Simon Marchi [Thu, 27 Aug 2015 13:47:14 +0000 (09:47 -0400)]
Fix inverted statements in m88k_analyze_prologue
These two statements were inverted by mistake in commit "Replace some
xmalloc-family functions with XNEW-family ones". It obviously doesn't
make sense to have them in this order, which is why I am pushing this as
obvious.
gdb/ChangeLog:
* m88k-tdep.c (m88k_analyze_prologue): Fix inverted allocation
statements.
Simon Marchi [Thu, 27 Aug 2015 13:32:19 +0000 (09:32 -0400)]
Remove duplicate ChangeLog entry
Simon Marchi [Thu, 27 Aug 2015 13:30:00 +0000 (09:30 -0400)]
Document non-8-bits addressable memory support in NEWS
I think it would be a good idea to document that gdb now has (basic)
support to read/write memory on architectures with non-8-bits memory.
Hopefully somebody will see it and say "Hey! We can now (more easily)
port GDB to our strange DSP that has 32-bits-addressable memory!" and do
it.
gdb/ChangeLog:
* NEWS: Document support for non-8-bits addressable memory.
Pedro Alves [Thu, 27 Aug 2015 12:37:01 +0000 (13:37 +0100)]
gdbserver/proc-service.c: bogus return value conversion
Building in C++ mode shows:
int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
^
src/gdb/gdbserver/proc-service.c:93:64: error: invalid conversion from ‘int’ to ‘ps_err_e’ [-fpermissive]
return write_inferior_memory ((unsigned long) addr, buf, size);
^
It only works today by accident, write_inferior_memory does not return
a ps_err_e.
gdb/gdbserver/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* proc-service.c (ps_pdwrite): Return PS_ERR/PS_OK explicily.
Pedro Alves [Thu, 27 Aug 2015 12:26:23 +0000 (13:26 +0100)]
gdb: Drop use of obsolete AC_TYPE_SIGNAL
Since we're using sighandler_t, nothing else refers to RETSIGTYPE in
gdb.
(Actually, given gdb/remote.c has been assuming signal handlers return
void for a long time, we could have gotten get rid of this even
without gnulib's sighandler_t.)
gdb/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* configure.ac: Remove AC_TYPE_SIGNAL call.
* configure, config.in: Regenerate.
Pedro Alves [Thu, 27 Aug 2015 12:26:23 +0000 (13:26 +0100)]
gdb: Use sighandler_t everywhere
This fixes 14 build errors like these in C++ mode:
src/gdb/extension.c: In function ‘void install_sigint_handler(const signal_handler*)’:
src/gdb/extension.c:698:41: error: invalid conversion from ‘void (*)()’ to ‘__sighandler_t {aka void (*)(int)}’ [-fpermissive]
signal (SIGINT, handler_state->handler);
^
In file included from build-gnulib/import/signal.h:52:0,
from ../../src/gdb/extension.c:24:
/usr/include/signal.h:102:23: error: initializing argument 2 of ‘void (* signal(int, __sighandler_t))(int)’ [-fpermissive]
extern __sighandler_t signal (int __sig, __sighandler_t __handler)
^
Instead of this everywhere:
- RETSIGTYPE (*handle_sigint_for_compare) () = handle_sigint;
+ RETSIGTYPE (*handle_sigint_for_compare) (int) = handle_sigint;
Use sighandler_t (a GNU extension). That's OK to use unconditionaly
because gnulib's signal.h replacement makes sure that it is available.
gdb/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* cp-support.c (gdb_demangle): Use sighandler_t. Remove cast.
* extension-priv.h: Include signal.h.
(struct signal_handler) <handler>: Change type to sighandler_t.
* extension.c (install_gdb_sigint_handler): Use sighandler_t.
* inflow.c (sigint_ours, sigquit_ours): Change type to
sighandler_t.
(child_terminal_inferior): Remove casts.
(child_terminal_ours_1, new_tty): Use sighandler_t. Remove casts.
(osig): Change type to sighandler_t.
* nto-procfs.c (ofunc): Change type to sighandler_t.
(procfs_wait): Remove casts.
* remote-m32r-sdi.c (m32r_wait, m32r_load): Use sighandler_t.
* remote-sim.c (gdbsim_wait): Use sighandler_t.
* utils.c (wait_to_die_with_timeout): Use sighandler_t.
Pedro Alves [Thu, 27 Aug 2015 12:26:22 +0000 (13:26 +0100)]
Import the "signal-h" module from gnulib
This gives us a signal.h replacement that makes sure the sighandler_t
typedef (a GNU extension) is always available. A follow up patch will
make use of this.
gdb/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add signal-h.
* gnulib/aclocal.m4: Renegerate.
* gnulib/config.in: Renegerate.
* gnulib/configure: Renegerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Regenerate.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/signal_h.m4: New file.
* gnulib/import/signal.in.h: New file.
Pedro Alves [Thu, 27 Aug 2015 12:09:39 +0000 (13:09 +0100)]
Fix ChangeLog entry date and mention gdb/18804
Pedro Alves [Thu, 27 Aug 2015 12:03:15 +0000 (13:03 +0100)]
gdb: remove packet size limit
The remote packet buffer size is currently capped to 16384 mostly for
historical reasons, related to use of alloca. Stop using alloca and
remove the limitation.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-27 Pedro Alves <palves@redhat.com>
* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE)
(MIN_MEMORY_PACKET_SIZE): New.
(MAX_REMOTE_PACKET_SIZE, MIN_REMOTE_PACKET_SIZE): Delete.
(get_memory_packet_size): Adjust. No longer limit the max packet
size.
(set_memory_packet_size): Adjust, and remove dead code.
(remote_check_symbols): Use xmalloc and a cleanup instead of
alloca.
(remote_packet_size): No longer cap the packet size.
(putpkt_binary): Use xmalloc and a cleanup instead of alloca.
Luis Machado [Thu, 27 Aug 2015 05:00:16 +0000 (02:00 -0300)]
Mention language in compile error message
This patch improves one of the compile error messages by mentioning the
language.
Before - No compiler support for this language.
After - No compiler support for language <language>.
gdb/ChangeLog:
2015-08-26 Luis Machado <lgustavo@codesourcery.com>
* compile/compile.c (compile_to_object): Mention language in
error message.
Luis Machado [Thu, 27 Aug 2015 04:49:05 +0000 (01:49 -0300)]
Force language to C in gdb.compile/compile-ifunc.exp
Due to the lack of debug information in the binary, GDB is unable to figure
out what language is being used. This may be a problem when doing remote
debugging and the binary stops at the entry point containing asm code.
In this case GDB will switch to asm as current language and will not switch
back to C when it reaches main, which in turn causes the compile feature check
to malfunction.
This is solved by forcing the language to C after reaching main.
gdb/testsuite/ChangeLog:
2015-08-26 Luis Machado <lgustavo@codesourcery.com>
* gdb.compile/compile-ifunc.exp (with_test_prefix): Force language
to C.
Alan Modra [Thu, 27 Aug 2015 01:29:36 +0000 (10:59 +0930)]
Add missing pr reference
Alan Modra [Thu, 27 Aug 2015 01:24:28 +0000 (10:54 +0930)]
Don't sort ld -r output relocs on alpha
LITERAL/LITUSE relocs must be kept together.
* elf64-alpha.c (elf64_alpha_sort_relocs_p): New function.
(elf_backend_sort_relocs_p): Define.
Patrick Palka [Thu, 30 Jul 2015 00:03:43 +0000 (20:03 -0400)]
Unset attach_flag when running a new process
We currently set attach_flag when attaching to a process, so we should
make sure to unset it when forking a new process. Otherwise attach_flag
would remain set after forking, if the previous process associated with
the inferior was attached to.
gdb/ChangeLog:
* target.c (target_pre_inferior): Unset attach_flag.
gdb/testsuite/ChangeLog:
* gdb.base/run-after-attach.exp: New test file.
* gdb.base/run-after-attach.c: New test file.
GDB Administrator [Thu, 27 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 26 Aug 2015 21:31:47 +0000 (17:31 -0400)]
Fix gdbarch.c build error
I made a mistake while handling my previous patch. A change in
gdbarch causes a build failure.
gdb/ChangeLog:
* gdbarch.sh (append_name): Fix type in XRESIZEVEC.
* gdbarch.c: Re-generate.
Simon Marchi [Wed, 26 Aug 2015 21:16:07 +0000 (17:16 -0400)]
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
Don Breazeal [Wed, 26 Aug 2015 20:31:59 +0000 (13:31 -0700)]
Fix native follow-exec-mode "new"
This patch fixes a segmentation fault in native GDB when
handling an exec event with follow-exec-mode set to "new".
The stack trace from the segfault was this:
0 0x0000000000669594 in gdbarch_data (gdbarch=0x0, data=0x20da7a0)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/gdbarch.c:4847
1 0x00000000004d430e in get_remote_arch_state ()
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:603
2 0x00000000004d431e in get_remote_state ()
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:616
3 0x00000000004dda8b in discard_pending_stop_replies (inf=0x217c710)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/remote.c:5775
4 0x00000000006a5928 in observer_inferior_exit_notification_stub (
data=0x4dda7a <discard_pending_stop_replies>, args_data=0x7fff12c258f0)
at ./observer.inc:1137
5 0x00000000006a419a in generic_observer_notify (subject=0x21dfbe0,
args=0x7fff12c258f0)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/observer.c:167
6 0x00000000006a59ba in observer_notify_inferior_exit (inf=0x217c710)
at ./observer.inc:1162
7 0x00000000007981d5 in exit_inferior_1 (inftoex=0x217c710, silent=1)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/inferior.c:244
8 0x00000000007982f2 in exit_inferior_num_silent (num=1)
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/inferior.c:286
9 0x000000000062f93d in follow_exec (ptid=...,
execd_pathname=0x7fff12c259a0 "/scratch/dbreazea/sandbox/exec-nat/build/gdb/testsuite/gdb.base/execd-prog")
at /scratch/dbreazea/sandbox/exec-nat/binutils-gdb/gdb/infrun.c:1195
In follow_exec we were creating a new inferior for the execd program,
as required by the exec mode, but we were doing it before calling
exit_inferior_num_silent on the original inferior. So on entry to
exit_inferior_num_silent we had two inferiors with the same ptid.
In the calls made by exit_inferior_num_silent, the current inferior
is temporarily saved and replaced in order to make use of functions
that only operate on the current inferior (for example, in
do_all_continuations, called while deleting the threads of the original
inferior). When we restored the original inferior, we just took the
first inferior that matched the ptid of the original and got the new
(wrong) one. It hadn't been initialized yet and had no gdbarch
pointer, and GDB segfaulted.
The fix for that is to call exit_inferior_num_silent before adding the new
inferior, so that we never have two inferiors with the same ptid. Then
exit_inferior_num_silent uses the original inferior as the current inferior
throughout, and can find a valid gdbarch pointer.
Once we have finished with the exit of the old inferior and added the
new one, we need to create a new thread for the new inferior. In the
function that called follow_exec, handle_inferior_event_1,
ecs->event_thread now points to the thread that was deleted with the
exit of the original inferior. To remedy this we create the new thread,
and once we return from follow_exec we reset ecs->event_thread.
Note that we are guaranteed that we can reset ecs->event_thread
safely using inferior_thread because we have set the current
inferior in follow_exec, and inferior_ptid was set by the call
to context_switch at the beginning of exec event handling.
gdb/ChangeLog:
* infrun.c (follow_exec): Re-order operations for
handling follow-exec-mode "new".
(handle_inferior_event_1): Assign ecs->event_thread
to the current thread.
* remote.c (get_remote_arch_state): Add an assertion.
Don Breazeal [Wed, 26 Aug 2015 20:26:36 +0000 (13:26 -0700)]
New test for follow-exec-mode
This patch implements a new GDB test for follow-exec-mode. Although
there is a GDB test for debugging across an exec, there is no test for
follow-exec-mode. This test is derived from gdb.base/foll-exec.exp,
and re-uses execd-prog.c as the program to exec.
The following behavior is tested:
follow-exec-mode == "same"
- 'next' over the exec, check for one inferior
- 'continue' past the exec to a breakpoint, check for one inferior
- after the exec, use a 'run' command to run the current binary
follow-exec-mode == "new"
- 'next' over the exec, check for two inferiors
- 'continue' past the exec to a breakpoint, check for two inferiors
- after the exec, use a 'run' command to run the current binary
- after the exec, use the 'inferior' command to switch inferiors,
then use a 'run' command to run the current binary
Note that single-step breakpoints do not survive across an exec.
There has to be a breakpoint in the execed program in order for
it to stop right after the exec.
gdb/testsuite/ChangeLog:
* gdb.base/foll-exec-2.c: New test program.
* gdb.base/foll-exec-2.exp: New test.
Pedro Alves [Wed, 26 Aug 2015 16:50:02 +0000 (17:50 +0100)]
gdb: Add Markus Metzger as btrace maintainer
gdb/ChangeLog:
2015-08-26 Pedro Alves <palves@redhat.com>
* MAINTAINERS: Add Markus Metzger as btrace maintainer.
Alan Modra [Wed, 26 Aug 2015 08:02:08 +0000 (17:32 +0930)]
Use stable sort for ld -r relocs
A number of targets emit multiple relocs at a given r_offset, and
depend on those relocs staying in their original order.
PR 18867
* elflink.c (cmp_ext32l_r_offset, cmp_ext32b_r_offset): Delete.
(cmp_ext64l_r_offset, cmp_ext64b_r_offset): Delete.
(ext32l_r_offset, ext32b_r_offset, ext64l_r_offset, ext64b_r_offset):
New functions.
(elf_link_adjust_relocs): Use an insertion sort to sort relocs.
Matthew Fortune [Wed, 26 Aug 2015 13:42:56 +0000 (14:42 +0100)]
Select MIPS ABi based upon abiflags rather than e_flags.
bfd PR ld/18401
* elfxx-mips.c (bfd_mips_isa_ext_mach): New function: Converts an
ISA value to a bfd machine number.
(bfd_mips_isa_ext): Update the ISA level and revision if
necessary. Use mips_mach_extends_p to decide if the ISA extension
needs to be set.
(_bfd_mips_elf_merge_private_bfd_data): Allow the ISA extension to
be inferred from the ABI setting. Set the ISA level from the
maximum of the incoming and outgoing ISA levels.
tests
* ld-mips-elf/mips-elf-flags.exp: Add more ISA conflict tests.
Alan Modra [Wed, 26 Aug 2015 13:25:41 +0000 (22:55 +0930)]
Fallout from "Allow symbol and label names to be enclosed in double quotes"
PR gas/18581
* config/tc-mn10200.c (md_assemble <mdr>): Move restore_line_pointer
call to where input line used to be restored.
* config/tc-mn10300.c (md_assemble <usp>): Remove redundant input
line restore.
* config/tc-tilepro.c (parse_reg_expression): Add regname var.
Nick Clifton [Wed, 26 Aug 2015 09:56:26 +0000 (10:56 +0100)]
Add asprintf to the list of functions whose decls are checked at configure time.
PR gas/18842
* configure.ac (AS_CHECK_DECLS): Add asprintf.
* configure: Regenerate.
* config.in: Regenerate.
Cary Coutant [Wed, 26 Aug 2015 07:03:04 +0000 (00:03 -0700)]
Fix problem where script specified both address and region for a section.
If a script specifies both address and region for an output section
declaration, gold ignores the region specification. This can lead to
bogus "moves backward" errors. This patch fixes gold so that if a
section specifies both address and region, it will place the section
at the specified address in the region, and update the location counter
within the region.
gold/
PR gold/18847
* script-sections.cc (Memory_region::set_address): New method.
(Script_sections::find_memory_region): Add explicit_only parameter.
(Output_section_definition::set_section_addresses): Handle case where
script specifies both address and vma region.
* script-sections.h (Script_sections::find_memory_region): Add
explicit_only parameter.
Cary Coutant [Fri, 21 Aug 2015 19:32:33 +0000 (12:32 -0700)]
Fix --no-as-needed when shared library is listed twice on the command line.
When a shared library is listed twice on the command line, the linker
ignores the second mention. If the first mention is in the scope of
an --as-needed option, and the second one is under the scope of a
--no-as-needed option, the --no-as-needed should take effect, but
doesn't. This patch keeps track of the objects we've already seen,
and updates the --as-needed flag so that if a shared object is ever
seen with --no-as-needed, it will be marked as such.
gold/
PR gold/18859
* object.cc (Input_objects::add_object): Store objects in a map,
indexed by soname; update as-needed flag when necessary.
* object.h (Object::clear_as_needed): New method.
(Input_objects::so_names_): Change from set to map.
Cary Coutant [Wed, 26 Aug 2015 00:41:19 +0000 (17:41 -0700)]
Fix internal error in gold when script uses section address in assignment.
When processing assignment expressions in a linker script, gold processes
absolute assignments early, but when one of those assignments involves the
address of a section that has not yet been finalized, we get an internal
error in address. This patch fixes the problem by gracefully returning
from expression evaluation even if the address is not yet valid, and
deferring the assignment in such a case.
gold/
PR gold/14746
* expression.cc (Expression::Expression_eval_info): Add
is_valid_pointer field.
(Expression::eval_maybe_dot): Add is_valid_pointer parameter.
Adjust all callers.
(Addr_expression::value_from_output_section): Check whether address
is valid.
* script.cc (Symbol_assignment::set_if_absolute): Defer assignment
if evaluation failed due to address that is not yet valid.
* script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
parameter.
Cary Coutant [Wed, 26 Aug 2015 00:53:53 +0000 (17:53 -0700)]
Fix regression introduced by fix for PR 18703.
When a user object overrides a versioned definition in a shared object,
it's possible to trigger an internal error because the versioned
definition we saw didn't override the unversioned definition. This
was introduced by the fix for PR 18703. This patch fixes the problem
by reordering the tests so that we do not check ret->is_default()
until we're confident that the symbol is in fact versioned.
gold/
PR gold/18866
PR gold/18703
* symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
GDB Administrator [Wed, 26 Aug 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Tue, 25 Aug 2015 16:48:20 +0000 (17:48 +0100)]
Replace assertions with warning messages about ELF binaries containing multiple symbol tables.
PR binutils/18854
* elf.c (bfd_section_from_shdr): Replace assertions with warnings
about multiple symbol tables.
Simon Dardis [Tue, 25 Aug 2015 16:04:51 +0000 (17:04 +0100)]
Update MIPS tests for test failures on some configurations.
* gas/mips/micromips32-move.d: Update expected disassembly.
* gas/mips/move.d: Likewise.
* gas/mips/move.s: Fix for some MIPS configurations.
Pedro Alves [Tue, 25 Aug 2015 15:12:11 +0000 (16:12 +0100)]
remote: allow aborting long operations (e.g., file transfers)
Currently, when remote debugging, if you type Ctrl-C just while the
target stopped for an internal event, and GDB is busy doing something
that takes a while (e.g., fetching chunks of a shared library off of
the target, with vFile, to process ELF headers and debug info), the
Ctrl-C is lost.
The patch hooks up the QUIT macro to a new target method that lets the
target react to the double-Ctrl-C before the event loop is reached,
which allows reacting to a double-Ctrl-C even when GDB is busy doing
some long operation and not waiting for a stop reply. That end result
is:
(gdb) c
Continuing.
^C
^C
Interrupted while waiting for the program.
Give up waiting? (y or n) y
Quit
(gdb) info threads
Id Target Id Frame
* 1 Thread 11673 0x00007ffff7deb240 in _dl_debug_state () from target:/lib64/ld-linux-x86-64.so.2
(gdb)
If, however, GDB is waiting for a stop reply (because the target has
been resumed, with e.g., vCont;c), but the target isn't responding, we
now get:
(gdb) c
Continuing.
^C
^C
The target is not responding to interrupt requests.
Stop debugging it? (y or n) y
Disconnected from target.
(gdb) info threads
No threads.
This offers to disconnect, because when we're waiting for a stop
reply, there's nothing else we can send the target other than an
interrupt request. And if that doesn't work, there's nothing else we
can do.
The Ctrl-C is presently lost because until we get to a user-visible
stop, the SIGINT handler that is installed is the one that forwards
the interrupt to the remote side, with the \003 "packet" [1]. But,
gdbserver ignores an interrupt request if the program is stopped.
Still, even if it didn't, the server can only report back a
stop-because-of-SIGINT when the program is next resumed. And it may
take a while to actually re-resume the target.
[1] - In the old sync days, the remote target would react to a
double-Ctrl-C by asking users whether they wanted to give up waiting
and disconnect. The code is still there, but it it isn't reacheable
on most hosts, which support serial connections in async mode
(probably only DJGPP doesn't). Even then, in sync mode, remote.c's
SIGINT handler is only installed while the target is resumed, and is
removed as soon as the target sends back a stop reply. That means
that a Ctrl-C just while GDB is processing an internal event can end
up with an odd "Quit" at the prompt instead of "Program stopped by
SIGINT". In contrast, in async mode, remote.c's SIGINT handler is set
up as long as target_terminal_inferior or
target_terminal_ours_for_output are in effect (IOW, until we get a
user-visible stop and call target_terminal_ours), so the user
shouldn't get back a spurious Quit. However, it's still desirable to
be able to interrupt a long-running GDB operation, if GDB takes a
while to re-resume the target or get back to the event loop.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-08-24 Pedro Alves <palves@redhat.com>
* defs.h (maybe_quit): Declare.
(QUIT): Now calls maybe_quit.
* event-loop.c (clear_async_signal_handler)
(async_signal_handler_is_marked): New functions.
* event-loop.h (async_signal_handler_is_marked)
(clear_async_signal_handler): New declarations.
* remote.c (remote_check_pending_interrupt): New function.
(interrupt_query): Use make_cleanup_restore_target_terminal. No
longer check whether the target is async. If waiting for a stop
reply, and a Ctrl-C as been sent to the target, offer to
disconnect, and throw TARGET_CLOSE_ERROR instead of a quit.
Otherwise do not disconnect and throw a quit.
(_initialize_remote): Install remote_check_pending_interrupt as
to_check_pending_interrupt.
* target.c (target_check_pending_interrupt): New function.
* target.h (struct target_ops) <to_check_pending_interrupt>: New
field.
(target_check_pending_interrupt): New declaration.
* utils.c (maybe_quit): New function.
* target-delegates.c: Regenerate.
Jose E. Marchesi [Tue, 25 Aug 2015 15:16:34 +0000 (17:16 +0200)]
Support for the sparc %pmcdper privileged register.
opcodes/ChangeLog:
2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (print_insn_sparc): Handle the privileged register
%pmcdper.
gas/ChangeLog:
2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (priv_reg_table): New privileged register
%pmcdper.
gas/testsuite/ChangeLog:
2015-08-25 Jose E. Marchesi <jose.marchesi@oracle.com>
* gas/sparc/wrpr.s: Test writing to the privileged %pmcdper
register.
* gas/sparc/wrpr.d: ...and the expected result.
* gas/sparc/rdpr.s: Test reading from the privileged %pmcdper
register.
* gas/sparc/rdpr.d: ...and the expected result.
Yao Qi [Tue, 25 Aug 2015 13:08:45 +0000 (14:08 +0100)]
Print tid in debug output of debug_reg_change_callback
In debug_reg_change_callback, we change debug registers of each LWP.
It makes more sense to print LWP's pid rather than group leader's pid.
gdb:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* nat/aarch64-linux-hw-point.c (debug_reg_change_callback):
Rename local variable pid to tid, and get lwpid of lwp. Update
debug output.
Pierre-Marie de Rodat [Thu, 5 Feb 2015 16:00:06 +0000 (17:00 +0100)]
DWARF: handle non-local references in nested functions
GDB's current behavior when dealing with non-local references in the
context of nested fuctions is approximative:
- code using valops.c:value_of_variable read the first available stack
frame that holds the corresponding variable (whereas there can be
multiple candidates for this);
- code directly relying on read_var_value will instead read non-local
variables in frames where they are not even defined.
This change adds the necessary context to symbol reads (to get the block
they belong to) and to blocks (the static link property, if any) so that
GDB can make the proper decisions when dealing with non-local varibale
references.
gdb/ChangeLog:
* ada-lang.c (ada_read_var_value): Add a var_block argument
and pass it to default_read_var_value.
* block.c (block_static_link): New accessor.
* block.h (block_static_link): Declare it.
* buildsym.c (finish_block_internal): Add a static_link
argument. If there is a static link, associate it to the new
block.
(finish_block): Add a static link argument and pass it to
finish_block_internal.
(end_symtab_get_static_block): Update calls to finish_block and
to finish_block_internal.
(end_symtab_with_blockvector): Update call to
finish_block_internal.
* buildsym.h: Forward-declare struct dynamic_prop.
(struct context_stack): Add a static_link field.
(finish_block): Add a static link argument.
* c-exp.y: Remove an obsolete comment (evaluation of variables
already start from the selected frame, and now they climb *up*
the call stack) and propagate the block information to the
produced expression.
* d-exp.y: Likewise.
* f-exp.y: Likewise.
* go-exp.y: Likewise.
* jv-exp.y: Likewise.
* m2-exp.y: Likewise.
* p-exp.y: Likewise.
* coffread.c (coff_symtab_read): Update calls to finish_block.
* dbxread.c (process_one_symbol): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
* compile/compile-c-symbols.c (convert_one_symbol): Promote the
"sym" parameter to struct block_symbol, update its uses and pass
its block to calls to read_var_value.
(convert_symbol_sym): Update the calls to convert_one_symbol.
* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update
call to read_var_value.
* dwarf2loc.c (block_op_get_frame_base): New.
(dwarf2_block_frame_base_locexpr_funcs): Implement the
get_frame_base method.
(dwarf2_block_frame_base_loclist_funcs): Likewise.
(dwarf2locexpr_baton_eval): Add a frame argument and use it
instead of the selected frame in order to evaluate the
expression.
(dwarf2_evaluate_property): Add a frame argument. Update call
to dwarf2_locexpr_baton_eval to provide a frame in available and
to handle the absence of address stack.
* dwarf2loc.h (dwarf2_evaluate_property): Add a frame argument.
* dwarf2read.c (attr_to_dynamic_prop): Add a forward
declaration.
(read_func_scope): Record any available static link description.
Update call to finish_block.
(read_lexical_block_scope): Update call to finish_block.
* findvar.c (follow_static_link): New.
(get_hosting_frame): New.
(default_read_var_value): Add a var_block argument. Use
get_hosting_frame to handle non-local references.
(read_var_value): Add a var_block argument and pass it to the
LA_READ_VAR_VALUE method.
* gdbtypes.c (resolve_dynamic_range): Update calls to
dwarf2_evaluate_property.
(resolve_dynamic_type_internal): Likewise.
* guile/scm-frame.c (gdbscm_frame_read_var): Update call to
read_var_value, passing it the block coming from symbol lookup.
* guile/scm-symbol.c (gdbscm_symbol_value): Update call to
read_var_value (TODO).
* infcmd.c (finish_command_continuation): Update call to
read_var_value, passing it the block coming from symbol lookup.
* infrun.c (insert_exception_resume_breakpoint): Likewise.
* language.h (struct language_defn): Add a var_block argument to
the LA_READ_VAR_VALUE method.
* objfiles.c (struct static_link_htab_entry): New.
(static_link_htab_entry_hash): New.
(static_link_htab_entry_eq): New.
(objfile_register_static_link): New.
(objfile_lookup_static_link): New.
(free_objfile): Free the STATIC_LINKS hashed map if needed.
* objfiles.h: Include hashtab.h.
(struct objfile): Add a static_links field.
(objfile_register_static_link): New.
(objfile_lookup_static_link): New.
* printcmd.c (print_variable_and_value): Update call to
read_var_value.
* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
* python/py-frame.c (frapy_read_var): Update call to
read_var_value, passing it the block coming from symbol lookup.
* python/py-framefilter.c (extract_sym): Add a sym_block
parameter and set the pointed value to NULL (TODO).
(enumerate_args): Update call to extract_sym.
(enumerate_locals): Update calls to extract_sym and to
read_var_value.
* python/py-symbol.c (sympy_value): Update call to
read_var_value (TODO).
* stack.c (read_frame_local): Update call to read_var_value.
(read_frame_arg): Likewise.
(return_command): Likewise.
* symtab.h (struct symbol_block_ops): Add a get_frame_base
method.
(struct symbol): Add a block field.
(SYMBOL_BLOCK): New accessor.
* valops.c (value_of_variable): Remove frame/block handling and
pass the block argument to read_var_value, which does this job
now.
(value_struct_elt_for_reference): Update calls to
read_var_value.
(value_of_this): Pass the block found to read_var_value.
* value.h (read_var_value): Add a var_block argument.
(default_read_var_value): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/nested-subp1.exp: New file.
* gdb.base/nested-subp1.c: New file.
* gdb.base/nested-subp2.exp: New file.
* gdb.base/nested-subp2.c: New file.
* gdb.base/nested-subp3.exp: New file.
* gdb.base/nested-subp3.c: New file.
Renlin Li [Tue, 25 Aug 2015 11:37:21 +0000 (12:37 +0100)]
[AArch64] Fix a typo in the comment for BFD_RELOC_AARCH64_LD64_GOT_LO12_NC
2015-08-25 Renlin Li <renlin.li@arm.com>
bfd/
* reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): Use LP64 instead of
ILP64.
* bfd-in2.h: Regenerate.
Yao Qi [Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)]
Move aarch64_linux_new_thread to nat/aarch64-linux.c
This patch moves aarch64_linux_new_thread in GDB and GDBserver to
nat/aarch64-linux.c.
gdb:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_new_thread): Move it to ...
* nat/aarch64-linux.c (aarch64_linux_new_thread): ... here.
* nat/aarch64-linux.h (aarch64_linux_new_thread): Declare.
gdb/gdbserver:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_linux_new_thread): Remove.
Yao Qi [Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)]
Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.c
gdb:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* Makefile.in (aarch64-liunx.o): New rule.
(HFILES_NO_SRCDIR): Add aarch64-linux.h.
* config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o.
* aarch64-linux-nat.c: Include nat/aarch64-linux.h.
* aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it
extern.
(aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c.
* nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare
* nat/aarch64-linux.c: New file.
* nat/aarch64-linux.h: New file.
gdb/gdbserver:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* Makefile.in (aarch64-linux.o): New rule.
* configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to
srv_tgtobj.
* linux-aarch64-low.c: Include nat/aarch64-linux.h.
(aarch64_init_debug_reg_state): Make it extern.
(aarch64_linux_prepare_to_resume): Remove.
Yao Qi [Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)]
Make aarch64_linux_prepare_to_resume the same on GDB and GDBserver
gdb:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_prepare_to_resume): Use
lwp_arch_private_info and ptid_of_lwp.
gdb/gdbserver:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_linux_prepare_to_resume): Use
lwp_arch_private_info and ptid_of_lwp.
Yao Qi [Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)]
Add pid argument in aarch64_get_debug_reg_state
This patch addes argument pid in aarch64_get_debug_reg_state, so that
its interface is the same on both GDB and GDBserver.
gdb/gdbserver:
2015-018-25 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_get_debug_reg_state): Add argument pid.
Find proc_info by find_process_pid. All callers updated.
Yao Qi [Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)]
Move debug_reg_change_callback and aarch64_notify_debug_reg_change to nat/aarch64-linux-hw-point.c
gdb:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (struct arch64_dr_update_callback_param):
Move it to nat/aarch64-linux-hw-point.c.
(debug_reg_change_callback): Likewise.
(aarch64_notify_debug_reg_change): :Likewise.
* nat/aarch64-linux-hw-point.c: Include nat/linux-nat.h.
(aarch64_dr_update_callback_param): New.
(debug_reg_change_callback): New function.
(aarch64_notify_debug_reg_change): Likewise.
* nat/aarch64-linux-hw-point.h (aarch64_notify_debug_reg_change):
Remove the declaration.
gdb/gdbserver:
2015-08-25 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (struct arch64_dr_update_callback_param):
Remove.
(debug_reg_change_callback): Remove.
(aarch64_notify_debug_reg_change): Remove.