Alan Modra [Fri, 26 Sep 2014 00:00:35 +0000 (09:30 +0930)]
daily update
Pedro Alves [Mon, 22 Sep 2014 10:12:30 +0000 (11:12 +0100)]
infrun.c:user_visible_resume_ptid: Don't check singlestep_breakpoints_inserted_p
What matters for this function, is whether the user requested a
"step", for "set scheduler-locking step", not whether GDB is doing an
internal step for some reason.
/* Return a ptid representing the set of threads that we will proceed,
in the perspective of the user/frontend. */
extern ptid_t user_visible_resume_ptid (int step);
Therefore, the check for singlestep_breakpoints_inserted_p is actually
incorrect, and we end up applying schedlock more often on sss targets
than on non-sss targets.
Found by inspection while working on a patch that eliminates the
singlestep_breakpoints_inserted_p global.
Tested on x86_64 Fedora 20 on top of my 'software single-step on x86'
series.
gdb/
2014-09-25 Pedro Alves <palves@redhat.com>
* infrun.c (user_visible_resume_ptid): Don't check
singlestep_breakpoints_inserted_p.
Pedro Alves [Mon, 22 Sep 2014 13:11:53 +0000 (14:11 +0100)]
breakpoint.c: debug output when we skip inserting a breakpoint
gdb/
2014-09-25 Pedro Alves <palves@redhat.com>
* breakpoint.c (should_be_inserted): Add debug output.
Pedro Alves [Thu, 25 Sep 2014 15:31:04 +0000 (16:31 +0100)]
infrun.c: comment/typo fixes
gdb/
2014-09-25 Pedro Alves <palves@redhat.com>
* infrun.c (stepping_past_instruction_at)
(clear_exit_convenience_vars): Point at infrun.h instead of
inferior.h.
(handle_signal_stop): Fix typo.
Alan Modra [Thu, 25 Sep 2014 00:00:40 +0000 (09:30 +0930)]
daily update
Yao Qi [Fri, 19 Sep 2014 08:37:07 +0000 (16:37 +0800)]
Fix typo in thumb_in_function_epilogue_p
This patch fixes a typo in the bit mask I've made in my previous code
refactor. If PC is in the register list, the bit 8 is one, so bit
mask 0xff00 should be used. Current condition is a constant false.
gdb:
2014-09-24 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_in_function_epilogue_p): Fix typo in the
bitmask.
Alan Modra [Wed, 24 Sep 2014 08:36:58 +0000 (18:06 +0930)]
Regen gold POTFILES.in
* po/POTFILES.in: Regenerate.
Markus Trippelsdorf [Wed, 24 Sep 2014 08:34:53 +0000 (18:04 +0930)]
BFD: Add support for more than one plugin in lib/bfd-plugins
ar, nm and ranlib currently lack the ability to handle more than one
plugin in lib/bfd-plugins. This patch reshuffles the logic in plugin.c
to add this functionality. One can now place both llvm and gcc plugins
in this directory and have them loaded automatically.
Mixed gcc/llvm archives are also supported (but not very useful until
ld.bfd and ld.gold also would load multiple plugins and use them to
claim different object files).
PR 17422
* plugin.c (try_claim): New function. Moved from
bfd_plugin_object_p.
(try_load_plugin): Pass through bfd. Add test.
(load_plugin): Pass through bfd.
(bfd_plugin_object_p): Move logic to try_claim.
Cary Coutant [Wed, 24 Sep 2014 06:35:36 +0000 (23:35 -0700)]
Add PR reference to ChangeLog entry.
2014-09-23 Taiju Tsuiki <tzik@google.com>
Cary Coutant <ccoutant@google.com>
gold/
PR gold/14860
* gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
on input_sections_blocker.
* layout.cc (Write_sections_task::locks): Unblock
input_sections_blocker_.
* layout.h (Write_sections_task::Write_sections_task): Add
input_sections_blocker.
* testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
to DEPENDENCIES.
* testsuite/Makefile.in: Regenerate.
Cary Coutant [Wed, 24 Sep 2014 06:18:19 +0000 (23:18 -0700)]
Fix race condition causing assert in Eh_frame_hdr::do_sized_write().
2014-09-23 Taiju Tsuiki <tzik@google.com>
Cary Coutant <ccoutant@google.com>
gold/
* gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
on input_sections_blocker.
* layout.cc (Write_sections_task::locks): Unblock
input_sections_blocker_.
* layout.h (Write_sections_task::Write_sections_task): Add
input_sections_blocker.
* testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
to DEPENDENCIES.
* testsuite/Makefile.in: Regenerate.
Alan Modra [Wed, 24 Sep 2014 00:00:52 +0000 (09:30 +0930)]
daily update
H.J. Lu [Tue, 23 Sep 2014 18:12:23 +0000 (11:12 -0700)]
Disallow VEX/EVEX encoded instructions in 16-bit mode
gas/
PR gas/17421
* config/tc-i386.c (md_assemble): Disallow VEX/EVEX encoded
instructions in 16-bit mode.
gas/testsuite/
PR gas/17421
* gas/i386/i386.exp: Run inval-16.
* gas/i386/inval-16.l: New file.
* gas/i386/inval-16.s: Likewise.
Yao Qi [Fri, 12 Sep 2014 05:35:11 +0000 (13:35 +0800)]
Honour SIGILL and SIGSEGV in cancel breakpoint and event lwp selection
I see the following fail on arm-none-linux-gnueabi testing,
(gdb) continue^M
Continuing.^M
^M
Program received signal SIGILL, Illegal instruction.^M
[Switching to Thread 1003]^M
handler (signo=10) at
/scratch/yqi/arm-none-linux-gnueabi/src/gdb-trunk/gdb/testsuite/gdb.threads/sigstep-threads.c:33^M
33 tgkill (getpid (), gettid (), SIGUSR1); /* step-2 */^M
(gdb) FAIL: gdb.threads/sigstep-threads.exp: continue
the cause is that GDBserver doesn't cancel the breakpoint if the stop
signal is SIGILL. The kernel used here is a little old, 2.6.x, and
doesn't translate SIGILL to SIGTRAP when program hits breakpoint
instruction (which is an illegal instruction actually). GDB and
GDBserver can translate SIGILL to SIGTRAP under certain circumstance,
so it is not a problem here. See gdbserver/linux-low.c:linux_wait_1
/* If this event was not handled before, and is not a SIGTRAP, we
report it. SIGILL and SIGSEGV are also treated as traps in case
a breakpoint is inserted at the current PC. If this target does
not support internal breakpoints at all, we also report the
SIGTRAP without further processing; it's of no concern to us. */
maybe_internal_trap
= (supports_breakpoints ()
&& (WSTOPSIG (w) == SIGTRAP
|| ((WSTOPSIG (w) == SIGILL
|| WSTOPSIG (w) == SIGSEGV)
&& (*the_low_target.breakpoint_at) (event_child->stop_pc))));
However, SIGILL and SIGSEGV is not considered when cancelling
breakpoint, which causes the fail above. That is, when GDB is doing
software single step on address ADDR, both thread A and thread B hits the
software single step breakpoint, and get SIGILL. GDB selects the event
from thread A, removes the software single step breakpoint, and resume
the program. The event (SIGILL) from thread B is reported to GDB, but
GDB doesn't regard this SIGILL as SIGTRAP, because the breakpoint on
address ADDR was removed, so GDB reports "Program received signal
SIGILL".
The patch is to allow calling cancel_breakpoint if the signal is
SIGILL and SIGSEGV. This patch fixes the fail above. Likewise, event
lwp selection should honour SIGILL and SIGSEGV too.
gdb/gdbserver:
2014-09-23 Yao Qi <yao@codesourcery.com>
* linux-low.c (lp_status_maybe_breakpoint): New function.
(linux_low_filter_event): Call lp_status_maybe_breakpoint.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(cancel_breakpoints_callback): Likewise.
Alan Modra [Tue, 23 Sep 2014 00:00:37 +0000 (09:30 +0930)]
daily update
Sterling Augustine [Tue, 25 Jan 2011 21:59:13 +0000 (13:59 -0800)]
Fix 'call8: call target out of range' xtensa ld relaxation bug
During link-time relaxation distance between cross-section call site and
its target may grow, producing 'call target out of range' error for
relaxed calls. Be more conservative when calculating whether or not a
callx can be converted to a straight call.
2014-09-23 Sterling Augustine <augustine.sterling@gmail.com>
bfd/
* elf32-xtensa.c (is_resolvable_asm_expansion): for cross-section
call relaxation use furthermost addresses where call source and
destination can be to check whether it's in the range of a direct
call.
H.J. Lu [Mon, 22 Sep 2014 16:38:53 +0000 (09:38 -0700)]
Ignore MOD field for control/debug register move
This patch ignores the MOD field in control/debug register move
instructions.
gas/testsuite/
* gas/i386/cdr.d: New file.
* gas/i386/cdr.s: Likewise.
* gas/i386/x86-64-cdr.d: Likewise.
* gas/i386/i386.exp: Run cdr and x86-64-cdr.
opcodes/
* i386-dis.c (MOD_0F20): Removed.
(MOD_0F21): Likewise.
(MOD_0F22): Likewise.
(MOD_0F23): Likewise.
(dis386_twobyte): Replace MOD_0F20, MOD_0F21, MOD_0F22 and
MOD_0F23 with "movZ".
(mod_table): Remove MOD_0F20, MOD_0F21, MOD_0F22 and MOD_0F23.
(OP_R): Check mod/rm byte and call OP_E_register.
Chen Gang [Sat, 20 Sep 2014 03:50:14 +0000 (11:50 +0800)]
readline/search.c: Remove useless parameter '0' for rl_message()
The related warning under Darwin x86_64:
gcc -c -DHAVE_CONFIG_H -I. -I../../binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 ../../binutils-gdb/readline/search.c
../../binutils-gdb/readline/search.c:213:24: warning: data argument not used by format string [-Wformat-extra-args]
rl_message ("%s", p, 0);
~~~~ ^
1 warning generated.
readline/ChangeLog.gdb:
* search.c (_rl_nsearch_init): Remove useless parameter '0' for
rl_message().
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Jan-Benedict Glaw [Mon, 22 Sep 2014 11:02:10 +0000 (13:02 +0200)]
2014-09-22 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* gdb.texinfo (Set Breaks): Add missing "@end table".
Gary Benson [Mon, 22 Sep 2014 10:33:59 +0000 (11:33 +0100)]
Update target_stop's documentation
This commit updates target_stop's documentation to clarify that
it is asynchronous.
gdb/ChangeLog:
* target.c (target_stop): Updated comment.
Gary Benson [Mon, 22 Sep 2014 10:33:59 +0000 (11:33 +0100)]
Rename target_{stop,continue}_ptid
This commit renames target_stop_ptid as target_stop_and_wait and
target_continue_ptid as target_continue_no_signal. Comments are
updated to more fully describe the functions' behaviour.
gdb/ChangeLog:
* target/target.h (target_stop_ptid): Renamed as...
(target_stop_and_wait): New function. Updated comment.
All uses updated.
(target_continue_ptid): Renamed as...
(target_continue_no_signal): New function. Updated comment.
All uses updated.
Alan Modra [Mon, 22 Sep 2014 08:44:27 +0000 (18:14 +0930)]
Find lto plugin when using gcc-5.0
I originally had this as --print-prog-name and changed back to
--print-file-name to suit older gcc, neglecting to check whether
gcc-5.0 --print-file-name finds the lto plugin. It doesn't.
* ld-plugin/lto.exp: Use both --print-file-name and --print-prog-name
when looking for lto plugin.
Alan Modra [Mon, 22 Sep 2014 08:39:49 +0000 (18:09 +0930)]
Fix various warnings seen when using gcc-5.0
* config/tc-m68k.c (md_assemble): Add assert to work around
bogus trunk gcc warning.
* config/tc-pj.h (md_convert_frag): Warning fix.
* config/tc-xtensa.c (xg_assemble_vliw_tokens): Warning fix.
Alan Modra [Mon, 22 Sep 2014 08:23:15 +0000 (17:53 +0930)]
Readelf: Handle forward references to CIEs
The linker side of pr16563 was fixed with commit
18cd5bce, but
unfortunately people continue to use older linkers with -flto. This
means we have binaries with working .eh_frame that can't be dumped by
readelf, and I'm seeing internal IBM bug reports about this fact.
PR 16563
* dwarf.c (GET): Remove semicolon.
(read_cie): New function, extracted from..
(display_debug_frames): ..here. Correctly handle signed offset
from FDE to CIE in .eh_frame. Decode forward referenced CIEs too.
Alan Modra [Mon, 22 Sep 2014 08:19:17 +0000 (17:49 +0930)]
Produce output file with -noinhibit-exec after overlapping FDE error
* elf-eh-frame (_bfd_elf_write_section_eh_frame_hdr): Don't return
false for overflow or overlapping FDEs. Give more detail in
error messages.
Pedro Alves [Mon, 22 Sep 2014 08:56:55 +0000 (09:56 +0100)]
Fix "breakpoint always-inserted off"; remove "breakpoint always-inserted auto"
By default, GDB removes all breakpoints from the target when the
target stops and the prompt is given back to the user. This is useful
in case GDB crashes while the user is interacting, as otherwise,
there's a higher chance breakpoints would be left planted on the
target.
But, as long as any thread is running free, we need to make sure to
keep breakpoints inserted, lest a thread misses a breakpoint. With
that in mind, in preparation for non-stop mode, we added a "breakpoint
always-inserted on" mode. This traded off the extra crash protection
for never having threads miss breakpoints, and in addition is more
efficient if there's a ton of breakpoints to remove/insert at each
user command (e.g., at each "step").
When we added non-stop mode, and for a period, we required users to
manually set "always-inserted on" when they enabled non-stop mode, as
otherwise GDB removes all breakpoints from the target as soon as any
thread stops, which means the other threads still running will miss
breakpoints. The test added by this patch exercises this.
That soon revealed a nuisance, and so later we added an extra
"breakpoint always-inserted auto" mode, that made GDB behave like
"always-inserted on" when non-stop was enabled, and "always-inserted
off" when non-stop was disabled. "auto" was made the default at the
same time.
In hindsight, this "auto" setting was unnecessary, and not the ideal
solution. Non-stop mode does depends on breakpoints always-inserted
mode, but only as long as any thread is running. If no thread is
running, no breakpoint can be missed. The same is true for all-stop
too. E.g., if, in all-stop mode, and the user does:
(gdb) c&
(gdb) b foo
That breakpoint at "foo" should be inserted immediately, but it
currently isn't -- currently it'll end up inserted only if the target
happens to trip on some event, and is re-resumed, e.g., an internal
breakpoint triggers that doesn't cause a user-visible stop, and so we
end up in keep_going calling insert_breakpoints. The test added by
this patch also covers this.
IOW, no matter whether in non-stop or all-stop, if the target fully
stops, we can remove breakpoints. And no matter whether in all-stop
or non-stop, if any thread is running in the target, then we need
breakpoints to be immediately inserted. And then, if the target has
global breakpoints, we need to keep breakpoints even when the target
is stopped.
So with that in mind, and aiming at reducing all-stop vs non-stop
differences for all-stop-on-stop-of-non-stop, this patch fixes
"breakpoint always-inserted off" to not remove breakpoints from the
target until it fully stops, and then removes the "auto" setting as
unnecessary. I propose removing it straight away rather than keeping
it as an alias, unless someone complains they have scripts that need
it and that can't adjust.
Tested on x86_64 Fedora 20.
gdb/
2014-09-22 Pedro Alves <palves@redhat.com>
* NEWS: Mention merge of "breakpoint always-inserted" modes "off"
and "auto" merged.
* breakpoint.c (enum ugll_insert_mode): New enum.
(always_inserted_mode): Now a plain boolean.
(show_always_inserted_mode): No longer handle AUTO_BOOLEAN_AUTO.
(breakpoints_always_inserted_mode): Delete.
(breakpoints_should_be_inserted_now): New function.
(insert_breakpoints): Pass UGLL_INSERT to
update_global_location_list instead of calling
insert_breakpoint_locations manually.
(create_solib_event_breakpoint_1): New, factored out from ...
(create_solib_event_breakpoint): ... this.
(create_and_insert_solib_event_breakpoint): Use
create_solib_event_breakpoint_1 instead of calling
insert_breakpoint_locations manually.
(update_global_location_list): Change parameter type from boolean
to enum ugll_insert_mode. All callers adjusted. Adjust to use
breakpoints_should_be_inserted_now and handle UGLL_INSERT.
(update_global_location_list_nothrow): Change parameter type from
boolean to enum ugll_insert_mode.
(_initialize_breakpoint): "breakpoint always-inserted" option is
now a boolean command. Update help text.
* breakpoint.h (breakpoints_always_inserted_mode): Delete declaration.
(breakpoints_should_be_inserted_now): New declaration.
* infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>:
Remove breakpoints_always_inserted_mode check.
(normal_stop): Adjust to use breakpoints_should_be_inserted_now.
* remote.c (remote_start_remote): Likewise.
gdb/doc/
2014-09-22 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Set Breaks): Document that "set breakpoint
always-inserted off" is the default mode now. Delete
documentation of "set breakpoint always-inserted auto".
gdb/testsuite/
2014-09-22 Pedro Alves <palves@redhat.com>
* gdb.threads/break-while-running.exp: New file.
* gdb.threads/break-while-running.c: New file.
Pedro Alves [Mon, 22 Sep 2014 08:56:55 +0000 (09:56 +0100)]
Tell update_global_location_list to insert breakpoints
This adds a new mode for update_global_location_list, that allows
callers saying "please insert breakpoints, even if
breakpoints_always_inserted_mode() is false". This allows removing a
couple breakpoints_always_inserted_mode checks.
gdb/
2014-09-22 Pedro Alves <palves@redhat.com>
* breakpoint.c (enum ugll_insert_mode): Add UGLL_INSERT.
(insert_breakpoints): Don't call insert_breakpoint_locations here.
Instead, pass UGLL_INSERT to update_global_location_list.
(update_global_location_list): Change parameter type from boolean
to enum ugll_insert_mode. All callers adjusted. Adjust to use
breakpoints_should_be_inserted_now and handle UGLL_INSERT.
(create_solib_event_breakpoint_1): New, factored out from ...
(create_solib_event_breakpoint): ... this.
(create_and_insert_solib_event_breakpoint): Use
create_solib_event_breakpoint_1 instead of calling
insert_breakpoint_locations manually.
(update_global_location_list): Handle UGLL_INSERT.
Pedro Alves [Mon, 22 Sep 2014 08:56:54 +0000 (09:56 +0100)]
Change parameter type of update_global_location_list from boolean to enum
Later we'll want a tristate, but for now, convert to an enum that maps 1-1
with the current boolean's true/false.
gdb/
2014-09-22 Pedro Alves <palves@redhat.com>
* breakpoint.c (enum ugll_insert_mode): New enum.
(update_global_location_list)
(update_global_location_list_nothrow): Change parameter type from
boolean to enum ugll_insert_mode. All callers adjusted.
Matthew Fortune [Mon, 22 Sep 2014 08:43:52 +0000 (09:43 +0100)]
MIPS: Don't sign extend the addend for RELA relocations
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Don't sign extend
the addend if relocations are RELA.
Kuan-Lin Chen [Mon, 22 Sep 2014 02:15:49 +0000 (10:15 +0800)]
NDS32/bfd: Synchronize the argument type.
Alan Modra [Mon, 22 Sep 2014 00:00:35 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 21 Sep 2014 00:00:36 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 20 Sep 2014 00:00:35 +0000 (09:30 +0930)]
daily update
Joel Brobecker [Fri, 19 Sep 2014 23:50:28 +0000 (16:50 -0700)]
Add Sergio Durigan Junior as maintainer of SystemTap support in GDB.
gdb/ChangeLog:
* MAINTAINERS: Add Sergio Durigan Junior as maintainer of
SystemTap support in GDB.
Don Breazeal [Fri, 19 Sep 2014 17:54:34 +0000 (10:54 -0700)]
Refactor ptrace extended event status.
This commit implements functions for identifying and extracting extended
ptrace event information from a Linux wait status. These are just
convenience functions intended to hide the ">> 16" used to extract the
event from the wait status word, replacing the hard-coded shift with a more
descriptive function call. This is preparatory work for implementation of
follow-fork and detach-on-fork for extended-remote linux targets.
gdb/ChangeLog:
* linux-nat.c (linux_handle_extended_wait): Call
linux_ptrace_get_extended_event.
(wait_lwp): Call linux_is_extended_waitstatus.
(linux_nat_filter_event): Call linux_ptrace_get_extended_event
and linux_is_extended_waitstatus.
* nat/linux-ptrace.c (linux_test_for_tracefork): Call
linux_ptrace_get_extended_event.
(linux_ptrace_get_extended_event): New function.
(linux_is_extended_waitstatus): New function.
* nat/linux-ptrace.h (linux_ptrace_get_extended_event)
(linux_is_extended_waitstatus): New declarations.
gdb/gdbserver/ChangeLog:
* linux-low.c (handle_extended_wait): Call
linux_ptrace_get_extended_event.
(get_stop_pc, get_detach_signal, linux_low_filter_event): Call
linux_is_extended_waitstatus.
---
Andreas Krebbel [Fri, 19 Sep 2014 10:44:54 +0000 (12:44 +0200)]
S/390: Don't replace R_390_TLS_LE32/64 with R_390_TLS_TPOFF for PIE.
bfd:
2014-09-19 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf32-s390.c: Don't replace R_390_TLS_LE32 with R_390_TLS_TPOFF
for PIE.
* elf64-s390.c: Don't replace R_390_TLS_LE64 with R_390_TLS_TPOFF
for PIE.
Yao Qi [Mon, 18 Aug 2014 01:57:40 +0000 (09:57 +0800)]
Run dw2-var-zero-addr.exp with --readnow
This patch is to extend dw2-var-zero-add.exp to cover the case that
partial symtabl is not used while full symtab is used, in order to
cover the changes in patch 2/3. This patch restarts GDB with
--readnow and does the same test again.
gdb/testsuite:
2014-09-19 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-var-zero-addr.exp: Move test into new proc test.
Invoke test. Restart GDB with --readnow and invoke test again.
Yao Qi [Mon, 4 Aug 2014 06:57:22 +0000 (14:57 +0800)]
Check function is GC'ed
I see the following fail on arm-none-eabi target,
(gdb) b 24^M
Breakpoint 1 at 0x4: file
../../../../git/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc,
line 24.^M
(gdb) FAIL: gdb.base/break-on-linker-gcd-function.exp: b 24
Currently, we are using flag has_section_at_zero to determine whether
address zero in debug info means the corresponding code has been
GC'ed, like this:
case DW_LNE_set_address:
address = read_address (abfd, line_ptr, cu, &bytes_read);
if (address == 0 && !dwarf2_per_objfile->has_section_at_zero)
{
/* This line table is for a function which has been
GCd by the linker. Ignore it. PR gdb/12528 */
However, this is incorrect on some bare metal targets, as .text
section is located at 0x0, so dwarf2_per_objfile->has_section_at_zero
is true. If a function is GC'ed by linker, the address is zero. GDB
thinks address zero is a function's address rather than this function
is GC'ed.
In this patch, we choose 'lowpc' got in read_file_scope to check
whether 'lowpc' is greater than zero. If it isn't, address zero really
means the function is GC'ed. In this patch, we pass 'lowpc' in
read_file_scope through handle_DW_AT_stmt_list and dwarf_decode_lines,
and to dwarf_decode_lines_1 finally.
This patch fixes the fail above. This patch also covers the path that
partial symbol isn't used, which is tested by starting gdb with
--readnow option.
It is regression tested on x86-linux with
target_board=dwarf4-gdb-index, and arm-none-eabi. OK to apply?
gdb:
2014-09-19 Yao Qi <yao@codesourcery.com>
* dwarf2read.c (dwarf_decode_lines): Update declaration.
(handle_DW_AT_stmt_list): Add argument 'lowpc'. Update
comments. Callers update.
(dwarf_decode_lines): Likewise.
(dwarf_decode_lines_1): Add argument 'lowpc'. Update
comments. Skip the line table if 'lowpc' is greater than
'address'. Don't check
dwarf2_per_objfile->has_section_at_zero.
gdb/testsuite:
2014-09-19 Yao Qi <yao@codesourcery.com>
* gdb.base/break-on-linker-gcd-function.exp: Move test into new
proc set_breakpoint_on_gcd_function. Invoke
set_breakpoint_on_gcd_function. Restart GDB with --readnow and
invoke set_breakpoint_on_gcd_function again.
Alan Modra [Fri, 19 Sep 2014 00:00:53 +0000 (09:30 +0930)]
daily update
Rafael Ávila de Espíndola [Thu, 18 Sep 2014 17:58:16 +0000 (13:58 -0400)]
A a testcase for common symbol handling with plugins.
2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* testsuite/Makefile.am (plugin_test_10): New test.
* testsuite/Makefile.in: Regenerate
* testsuite/plugin_common_test_2.c (c1): Align to 8.
* testsuite/plugin_test_10.sh: New file.
Doug Evans [Thu, 18 Sep 2014 17:09:12 +0000 (10:09 -0700)]
New "producer" attribute of python gdb.Symtab.
gdb/ChangeLog:
* NEWS: Mention new "producer" attribute of gdb.Symtab.
* python/py-symtab.c (stpy_get_producer): New function.
(symtab_object_getset): Add "producer" attribute.
gdb/doc/ChangeLog:
* python.texi (Symbol Tables In Python): Document "producer"
attribute of gdb.Symtab objects.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/symtab-producer.exp: New file.
Jan Kratochvil [Thu, 18 Sep 2014 06:21:40 +0000 (08:21 +0200)]
Fix regression for Linux vDSO in GDB (PR gdb/17407).
since
5979d6b69b20a8355ea94b75fad97415fce4788c
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=
5979d6b69b20a8355ea94b75fad97415fce4788c
vdso handling
https://sourceware.org/ml/binutils/2014-03/msg00082.html
https://sourceware.org/ml/binutils/2014-04/msg00003.html
Message-ID: <
A78C989F6D9628469189715575E55B230AA884EB@IRSMSX104.ger.corp.intel.com>
I get on
kernel-3.16.2-200.fc20.x86_64
https://koji.fedoraproject.org/koji/buildinfo?buildID=575860
attaching its vdso.bin.gz
GDB (FSF HEAD
5e43d46791c4c66fd83947a12d4f716b561a9103) regression:
reproducer:
./gdb -ex start ./gdb
actual result / FAIL:
Got object file from memory but can't read symbols: File truncated.
expected result / PASS:
<nothing>
or / PASS:
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
That "warning: Could not load shared library..." is mostly harmless (it is
a bug in GDB), in the FAIL case it is not printed just because
bfd_check_format() fails there.
It seems logical to me this way when the 'size' parameter has been already
added.
Alan Modra:
I was wrongly thinking that the section headers were
always last when I wrote that code. (They are now! If you relink
that vdso with current binutils master you won't hit this problem, but
that of course doesn't help existing kernels.)
I do not see a regression for add-symbol-file-from-memory for libncurses.so.5
from the original thread above.
Start of section headers: 1080 (bytes into file)
Size of section headers: 64 (bytes)
Number of section headers: 13
Section header string table index: 8
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 8] .fake_shstrtab STRTAB
0000000000000780 000780 000076 00 A 0 0 32
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0012fe 0x0012fe R E 0x1000
size == 0x2000
shdr_end == 0x778 == 1080 + 13 * 64
high_offset == 0x12fe
else if (size >= shdr_end)
- high_offset = shdr_end;
+ high_offset = size;
But then 0x778 < 0x780 for "Section header string table index" so whole
bfd_check_format() fails because section headers were not cleared here:
/* If the segments visible in memory didn't include the section headers,
then clear them from the file header. */
if (high_offset < shdr_end)
bfd/ChangeLog
2014-09-18 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/17407
* elfcode.h (bfd_from_remote_memory): Use SIZE for HIGH_OFFSET.
Alan Modra [Thu, 18 Sep 2014 00:00:48 +0000 (09:30 +0930)]
daily update
Cary Coutant [Wed, 17 Sep 2014 22:11:47 +0000 (15:11 -0700)]
Regenerate gold/Makefile.in.
Rafael Ávila de Espíndola [Wed, 17 Sep 2014 21:53:49 +0000 (17:53 -0400)]
Fix handling of common symbols with plugins.
gold/ChangeLog:
2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
* resolve.cc (Symbol_table::resolve): Don't override common symbols
during the replacement phase.
Jing Yu [Wed, 17 Sep 2014 21:14:59 +0000 (14:14 -0700)]
Add tls support to gold aarch64 backend.
elfcpp/ChangeLog:
2014-09-17 Han Shen <shenhan@google.com>
* aarch64.h (R_AARCH64_TLS_DTPREL64): Switch enum value with ...
(R_AARCH64_TLS_DTPMOD64): ... enum value.
gold/ChangeLog:
2014-09-17 Han Shen <shenhan@google.com>
Jing Yu <jingyu@google.com>
* aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
* aarch64.cc (Target_aarch64): Add data members
got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
constructor.
(Target_aarch64::do_reloc_symbol_index): New method.
(Target_aarch64::do_reloc_addend): New method.
(Target_aarch64::add_tlsdesc_info): New method.
(Target_aarch64::do_dynsym_value): New method.
(Target_aarch64::do_make_data_plt): Add new parameters: got,
got_irelative. Pass them to Output_data_plt_aarch64_standard.
(Target_aarch64::make_data_plt): Add new parameters: got,
got_irelative. Pass them to do_make_data_plt.
(Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
(Target_aarch64::Relocate:tls_gd_to_le): New method.
(Target_aarch64::Relocate:tls_ie_to_le): New method.
(Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
(Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
(Target_aarch64::got_tlsdesc_section): New method.
(Target_aarch64::make_local_ifunc_plt_entry): New method.
(Target_aarch64::define_tls_base_symbol): New method.
(Target_aarch64::reserve_tlsdesc_entries): New method.
(Target_aarch64::got_mod_index_entry): New method.
(Target_aarch64::rela_tlsdesc_section): New method.
(Target_aarch64::rela_irelative_section): New method.
(Target_aarch64::Tlsdesc_info): New struct.
(Target_aarch64::got_section): Create .got.plt space for IRELATIVE
relocations and tlsdesc relocations.
(Target_aarch64::optimize_tls_reloc): Implement method.
(Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
in constructor.
(Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
(Output_data_plt_aarch64::has_tlsdesc_entry): New method.
(Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
(Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
(Output_data_plt_aarch64::rela_tlsdesc): New method.
(Output_data_plt_aarch64::rela_irelative): New method.
(Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
(Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
(Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
(Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
(Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
(Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
(Output_data_plt_aarch64_standard): New member variables:
plt_tlsdesc_entry_size, tlsdesc_plt_entry.
(Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
New parameter: got, got_irelative.
(Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
(Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
(Output_data_plt_aarch64::do_write): Replace got_address with
gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
(AArch64_relocate_functions::update_movnz): New method.
(AArch64_relocate_functions): Correct format.
(AArch64_relocate_functions::movnz): New method.
(Target_aarch64::Scan::local): Correct format. Move r_sym, got to
before the switch. Add new cases to switch.
Check ie_to_le relaxation on tlsie relocations. Add code handling
tlsgd tlsdesc cases.
(Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
needed. Add new cases to switch. Insert dynamic RELATIVE relocation
when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
Call reloc_name_in_error_message to print unsupported reloc.
(Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
make_data_plt.
(Target_aarch64::do_finalize_sections): Emit relocs to save COPY
relocs. Fill in some more dynamic tags.
(Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
Skip call tls_get_addr when tlsgd is relaxed.
(Target_aarch64::Relocate::relocate_tls): Correct format. Add code
handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
tlsdesc->ie relaxation.
Ulrich Weigand [Wed, 17 Sep 2014 15:29:27 +0000 (17:29 +0200)]
PR gdb/17384: Do not print memory errors in safe_read_memory_integer
If accessing memory via safe_read_memory_integer fails, that function
used to print an error message even though callers were perfectly able
to handle (and even expected!) failures.
This patch removes the confusing message by changing the routine to
directly use target_read_memory.
gdb/ChangeLog:
PR gdb/17384
* corefile.c (struct captured_read_memory_integer_arguments): Remove.
(do_captured_read_memory_integer): Remove.
(safe_read_memory_integer): Use target_read_memory directly instead
of catching errors in do_captured_read_memory_integer.
Tristan Gingold [Wed, 17 Sep 2014 08:43:00 +0000 (10:43 +0200)]
Fix arm-elf build failure on non-C99 systems (was using int64_t)
gas/
* config/tc-arm.c (move_or_literal_pool, add_to_lit_pool): Use
bfd_int64_t instead of int64_t.
Sergio Durigan Junior [Wed, 17 Sep 2014 02:54:03 +0000 (22:54 -0400)]
Add test for global variable that is nested by another DSO
This is just a testcase addition that I am proposing for upstream GDB.
We have this in our internal tree, and the related RH bug is:
<https://bugzilla.redhat.com/show_bug.cgi?id=809179>
(You might not be able to see all the comments without privileges.)
This bug is about a global variable that got incorrectly displayed by
GDB. This bug has already been fixed a long time ago by Joel's
commit:
commit
19630284f570790ebf6d50bfb43caa1f125ee88a
Author: Joel Brobecker <brobecker@gnat.com>
Date: Tue Jun 5 13:50:50 2012 +0000
But I think a testcase for it wouldn't hurt.
So, consider the following scenario:
$ cat solib1.c
int test;
void c_main (void)
{
test = 42;
}
$ cat solib2.c
int test;
void b_main (void)
{
test = 42;
}
$ cat main.c
int main (int argc, char *argv[])
{
c_main ();
b_main ();
return 0;
}
$ gcc -g -fPIC -shared -o libSO1.so -c solib1.c
$ gcc -g -fPIC -shared -o libSO2.so -c solib2.c
$ gcc -g -o main -L$PWD -lSO1 -lSO2 main.c
$ LD_LIBRARY_PATH=. gdb -q -batch -ex 'b c_main' -ex r -ex n -ex 'p test' ./main
...
$1 = 0
This happened with GDB before Joel's commit above. Now, things work
and GDB is able to correctly display the nested global variable:
$ LD_LIBRARY_PATH=. gdb -q -batch -ex 'b c_main' -ex r -ex n -ex 'p test' ./main
...
$1 = 42
The testcase attached tests this behavior.
gdb/testsuite/ChangeLog:
2014-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/global-var-nested-by-dso-solib1.c: New file.
* gdb.base/global-var-nested-by-dso-solib2.c: Likewise.
* gdb.base/global-var-nested-by-dso.c: Likewise.
* gdb.base/global-var-nested-by-dso.exp: Likewise.
Alan Modra [Wed, 17 Sep 2014 00:00:46 +0000 (09:30 +0930)]
daily update
Maciej W. Rozycki [Tue, 16 Sep 2014 22:45:30 +0000 (23:45 +0100)]
CONTRIBUTE: For internals refer to wiki, not gdb/doc
Joel Brobecker [Tue, 16 Sep 2014 18:55:01 +0000 (11:55 -0700)]
Fix CPPFLAGS handling in gdbserver's build.
In gdb/gdbserver/Makefile.in, IPAGENT_CFLAGS is defined using
an expression which references $(CPPFLAGS). But CPPFLAGS isn't
actually defined.
This patch first adds a CPPFLAGS definition, so as to inherit
the value passed at configure time (if any). And it then makes it
part of INTERNAL_CFLAGS_BASE, instead. There is no reason that
CPPFLAGS be useful for a certain class of source files, and not
the rest. This is also consistent with what's done in GDB.
gdb/gdbserver/ChangeLog:
* Makefile.in (CPPFLAGS): Define.
(INTERNAL_CFLAGS_BASE): Add ${CPPFLAGS}.
(IPAGENT_CFLAGS): Remove ${CPPFLAGS}.
Tested by rebuilding GDBserver with a dummy CPPFLAGS, and verifying
that the compilation command was altered as expected.
Sergio Durigan Junior [Tue, 16 Sep 2014 19:34:27 +0000 (15:34 -0400)]
Remove dead code from objc-lang.c (spurious "fprintf (stderr...")
This obvious change removes dead code from objc-lang.c. I was
grepping for "fprintf (stderr..." and found this code between "#if
0".."#endif" blocks.
2014-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* objc-lang.c (find_implementation_from_class): Remove dead code.
Sergio Durigan Junior [Tue, 16 Sep 2014 19:30:41 +0000 (15:30 -0400)]
Replace "fprintf (stderr..." by "fprintf_unfiltered (gdb_stdlog..."
This is an obvious replacement of "fprintf (stderr..." by
"fprintf_unfiltered (gdb_stdlog...", which is the standard to use in
these cases.
gdb/ChangeLog:
2014-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
PR cli/7233
* linux-nat.c (linux_nat_wait_1): Replace "fprintf (stderr..." by
"fprintf_unfiltered (gdb_stdlog...)".
Sergio Durigan Junior [Tue, 16 Sep 2014 16:55:20 +0000 (17:55 +0100)]
gdb.base/watch-bitfields.exp: Improve test
Make test messages unique and a couple other tweaks.
gdb/testsuite/
2014-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>
* gdb.base/watch-bitfields.exp: Pass string other than test file
name to prepare_for_testing.
(watch): New procedure.
(expect_watchpoint): Use with_test_prefix.
(top level): Factor out tests to ...
(test_watch_location, test_regular_watch): ... these new
procedures, and use with_test_prefix and gdb_continue_to_end.
Patrick Palka [Tue, 16 Sep 2014 16:40:06 +0000 (17:40 +0100)]
Fix PR12526: -location watchpoints for bitfield arguments
PR 12526 reports that -location watchpoints against bitfield arguments
trigger false positives when bits around the bitfield, but not the
bitfield itself, are modified.
This happens because -location watchpoints naturally operate at the
byte level, not at the bit level. When the address of a bitfield
lvalue is taken, information about the bitfield (i.e. its offset and
size) is lost in the process.
This information must first be retained throughout the lifetime of the
-location watchpoint. This patch achieves this by adding two new
fields to the watchpoint struct: val_bitpos and val_bitsize. These
fields are set when a watchpoint is first defined in watch_command_1.
They are both equal to zero if the watchpoint is not a -location
watchpoint or if the argument is not a bitfield.
Then these bitfield parameters are used inside update_watchpoint and
watchpoint_check to extract the actual value of the bitfield from the
watchpoint address, with the help of a local helper function
extract_bitfield_from_watchpoint_value.
Finally when creating a HW breakpoint pointing to a bitfield, we
optimize the address and length of the breakpoint. By skipping over
the bytes that don't cover the bitfield, this step reduces the
frequency at which a read watchpoint for the bitfield is triggered.
It also reduces the number of times a false-positive call to
check_watchpoint is triggered for a write watchpoint.
gdb/
PR breakpoints/12526
* breakpoint.h (struct watchpoint): New fields val_bitpos and
val_bitsize.
* breakpoint.c (watch_command_1): Use these fields to retain
bitfield information.
(extract_bitfield_from_watchpoint_value): New function.
(watchpoint_check): Use it.
(update_watchpoint): Use it. Optimize the address and length of a
HW watchpoint pointing to a bitfield.
* value.h (unpack_value_bitfield): New prototype.
* value.c (unpack_value_bitfield): Make extern.
gdb/testsuite/
PR breakpoints/12526
* gdb.base/watch-bitfields.exp: New file.
* gdb.base/watch-bitfields.c: New file.
Ilya Tocar [Tue, 16 Sep 2014 09:33:47 +0000 (13:33 +0400)]
Add -mevexrcig={rne|rd|ru|rz} option to x86 assembler.
It is used to control which value is encoded in rounding control bits
for SAE-only EVEX instructions.
gas/
* config/tc-i386.c (evexrcig): New.
(build_evex_prefix): Force rounding bits.
(OPTION_MEVEXRCIG): New.
(md_longopts): Add mevexrcig.
(md_parse_option): Handle OPTION_MEVEXRCIG.
(md_show_usage): Document mevexrcig.
* doc/c-i386.texi (mevexrcig): Document new option.
gas/testsuite/
* gas/i386/avx512dq-rcig.s: New.
* gas/i386/avx512dq-rcigrd-intel.d: Likewise.
* gas/i386/avx512dq-rcigrd.d: Likewise.
* gas/i386/avx512dq-rcigrne-intel.d: Likewise.
* gas/i386/avx512dq-rcigrne.d: Likewise.
* gas/i386/avx512dq-rcigru-intel.d: Likewise.
* gas/i386/avx512dq-rcigru.d: Likewise.
* gas/i386/avx512dq-rcigrz-intel.d: Likewise.
* gas/i386/avx512dq-rcigrz.d: Likewise.
* gas/i386/avx512er-rcig.s: Likewise.
* gas/i386/avx512er-rcigrd-intel.d: Likewise.
* gas/i386/avx512er-rcigrd.d: Likewise.
* gas/i386/avx512er-rcigrne-intel.d: Likewise.
* gas/i386/avx512er-rcigrne.d: Likewise.
* gas/i386/avx512er-rcigru-intel.d: Likewise.
* gas/i386/avx512er-rcigru.d: Likewise.
* gas/i386/avx512er-rcigrz-intel.d: Likewise.
* gas/i386/avx512er-rcigrz.d: Likewise.
* gas/i386/avx512f-rcig.s: Likewise.
* gas/i386/avx512f-rcigrd-intel.d: Likewise.
* gas/i386/avx512f-rcigrd.d: Likewise.
* gas/i386/avx512f-rcigrne-intel.d: Likewise.
* gas/i386/avx512f-rcigrne.d: Likewise.
* gas/i386/avx512f-rcigru-intel.d: Likewise.
* gas/i386/avx512f-rcigru.d: Likewise.
* gas/i386/avx512f-rcigrz-intel.d: Likewise.
* gas/i386/avx512f-rcigrz.d: Likewise.
* gas/i386/x86-64-avx512dq-rcig.s: Likewise.
* gas/i386/x86-64-avx512dq-rcigrd-intel.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigrd.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigrne-intel.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigrne.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigru-intel.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigru.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigrz-intel.d: Likewise.
* gas/i386/x86-64-avx512dq-rcigrz.d: Likewise.
* gas/i386/x86-64-avx512er-rcig.s: Likewise.
* gas/i386/x86-64-avx512er-rcigrd-intel.d: Likewise.
* gas/i386/x86-64-avx512er-rcigrd.d: Likewise.
* gas/i386/x86-64-avx512er-rcigrne-intel.d: Likewise.
* gas/i386/x86-64-avx512er-rcigrne.d: Likewise.
* gas/i386/x86-64-avx512er-rcigru-intel.d: Likewise.
* gas/i386/x86-64-avx512er-rcigru.d: Likewise.
* gas/i386/x86-64-avx512er-rcigrz-intel.d: Likewise.
* gas/i386/x86-64-avx512er-rcigrz.d: Likewise.
* gas/i386/x86-64-avx512f-rcig.s: Likewise.
* gas/i386/x86-64-avx512f-rcigrd-intel.d: Likewise.
* gas/i386/x86-64-avx512f-rcigrd.d: Likewise.
* gas/i386/x86-64-avx512f-rcigrne-intel.d: Likewise.
* gas/i386/x86-64-avx512f-rcigrne.d: Likewise.
* gas/i386/x86-64-avx512f-rcigru-intel.d: Likewise.
* gas/i386/x86-64-avx512f-rcigru.d: Likewise.
* gas/i386/x86-64-avx512f-rcigrz-intel.d: Likewise.
* gas/i386/x86-64-avx512f-rcigrz.d: Likewise.
* gas/i386/i386.exp: Run new tests.
Pedro Alves [Tue, 16 Sep 2014 15:38:12 +0000 (16:38 +0100)]
Remove documention of dead "target vxworks"
"target vxworks" and friends have been removed 10 years ago already:
commit
e84ecc995d6a5e4e9114d3cea61717b8a573afb6
Author: Andrew Cagney <cagney@redhat.com>
AuthorDate: Sat Nov 13 23:10:02 2004 +0000
2004-11-13 Andrew Cagney <cagney@gnu.org>
* configure.tgt: Delete i[34567]86-*-vxworks*, m68*-netx-*,
m68*-*-vxworks*, mips*-*-vxworks*, powerpc-*-vxworks*, and
sparc-*-vxworks*.
* NEWS: Mention that vxworks was deleted.
(...)
* remote-vxmips.c, remote-vx.c: Delete.
* remote-vx68.c: Delete.
(...)
This removes related leftover cruft from the manual.
gdb/doc/
2014-09-16 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting) <run command>: Don't mention VxWorks.
(Embedded OS): Remove VxWorks menu entry.
(VxWorks): Remove node.
Gary Benson [Wed, 10 Sep 2014 09:37:11 +0000 (10:37 +0100)]
Rename current_inferior as current_thread in gdbserver
GDB has a function named "current_inferior" and gdbserver has a global
variable named "current_inferior", but the two are not equivalent;
indeed, gdbserver does not have any real equivalent of what GDB calls
an inferior. What gdbserver's "current_inferior" is actually pointing
to is a structure describing the current thread. This commit renames
current_inferior as current_thread in gdbserver to clarify this. It
also renames the function "set_desired_inferior" to "set_desired_thread"
and renames various local variables from foo_inferior to foo_thread.
gdb/gdbserver/ChangeLog:
* inferiors.h (current_inferior): Renamed as...
(current_thread): New variable. All uses updated.
* linux-low.c (get_pc): Renamed saved_inferior as saved_thread.
(maybe_move_out_of_jump_pad): Likewise.
(cancel_breakpoint): Likewise.
(linux_low_filter_event): Likewise.
(wait_for_sigstop): Likewise.
(linux_resume_one_lwp): Likewise.
(need_step_over_p): Likewise.
(start_step_over): Likewise.
(linux_stabilize_threads): Renamed save_inferior as saved_thread.
* linux-x86-low.c (x86_linux_update_xmltarget): Likewise.
* proc-service.c (ps_lgetregs): Renamed reg_inferior as reg_thread
and save_inferior as saved_thread.
* regcache.c (get_thread_regcache): Renamed saved_inferior as
saved_thread.
(regcache_invalidate_thread): Likewise.
* remote-utils.c (prepare_resume_reply): Likewise.
* thread-db.c (thread_db_get_tls_address): Likewise.
(disable_thread_event_reporting): Likewise.
(remove_thread_event_breakpoints): Likewise.
* tracepoint.c (gdb_agent_about_to_close): Renamed save_inferior
as saved_thread.
* target.h (set_desired_inferior): Renamed as...
(set_desired_thread): New declaration. All uses updated.
* server.c (myresume): Updated comment to reference thread instead
of inferior.
(handle_serial_event): Likewise.
(handle_target_event): Likewise.
Pedro Alves [Tue, 16 Sep 2014 13:27:57 +0000 (14:27 +0100)]
Fix watchpoint-stops-at-right-insn.exp
Silly typo...
gdb/testsuite/
2014-09-16 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint-stops-at-right-insn.exp (test): Compare
software and hardware addresses, not software address against
itself.
Pedro Alves [Tue, 16 Sep 2014 13:05:06 +0000 (14:05 +0100)]
Add test to make sure GDB knows which "kind" of watchpoint the target has
This adds a test that makes sure GDB knows whether the target has
continuable, or non-continuable watchpoints.
That is, the test confirms that GDB presents a watchpoint value change
at the first instruction right after the instruction that changes
memory.
gdb/testsuite/ChangeLog:
2014-09-16 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint-stops-at-right-insn.c: New file.
* gdb.base/watchpoint-stops-at-right-insn.exp: New file.
Samuel Thibault [Fri, 12 Sep 2014 18:29:11 +0000 (20:29 +0200)]
Add hardware watchpoint support for x86 GNU Hurd.
gdb/
* config/i386/i386gnu.mh (NATDEPFILES): Add x86-nat.o and
x86-dregs.o.
* gnu-nat.c (inf_threads): New function.
* gnu-nat.h (inf_threads_ftype): New typedef.
(inf_threads): New declaration.
* i386gnu-nat.c: Include "x86-nat.h" and "inf-child.h".
[i386_DEBUG_STATE] (i386_gnu_dr_get, i386_gnu_dr_set)
(i386_gnu_dr_set_control_one, i386_gnu_dr_set_control)
(i386_gnu_dr_set_addr_one, i386_gnu_dr_set_addr)
(i386_gnu_dr_get_reg, i386_gnu_dr_get_addr, 386_gnu_dr_get_status)
(i386_gnu_dr_get_control): New functions.
(reg_addr): New structure.
(_initialize_i386gnu_nat) [i386_DEBUG_STATE]: Initialize hardware
i386 debugging register hooks.
* NEWS: Mention this.
Terry Guo [Tue, 16 Sep 2014 12:08:22 +0000 (13:08 +0100)]
Make the linker return an error status if it fails to merge ARM binaries with
different architecture tags. Add a test case to make sure that this works,
and update readelf so that it will not seg-fault when trying to display the
attributes of binaries with invalid architecture tags.
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Return false if
failed to merge.
* ld-arm/attr-merge-arch-2.d: New test case.
* ld-arm/attr-merge-arch-2a.s: New test case source file.
* ld-arm/attr-merge-arch-2b.s: Likewise.
* ld-arm/arm-elf.exp: Run new test case.
* readelf.c (display_arm_attribute): Use unsigned int type for
tag, val and type variables.
Pedro Alves [Tue, 16 Sep 2014 11:37:03 +0000 (12:37 +0100)]
Remove support for testing against dead "target vxworks"
"target vxworks" and friends have been removed 10 years ago already:
commit
e84ecc995d6a5e4e9114d3cea61717b8a573afb6
Author: Andrew Cagney <cagney@redhat.com>
AuthorDate: Sat Nov 13 23:10:02 2004 +0000
2004-11-13 Andrew Cagney <cagney@gnu.org>
* configure.tgt: Delete i[34567]86-*-vxworks*, m68*-netx-*,
m68*-*-vxworks*, mips*-*-vxworks*, powerpc-*-vxworks*, and
sparc-*-vxworks*.
* NEWS: Mention that vxworks was deleted.
(...)
* remote-vxmips.c, remote-vx.c: Delete.
* remote-vx68.c: Delete.
(...)
This removes related leftover cruft from the testsuite.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/testsuite/
2014-09-16 Pedro Alves <palves@redhat.com>
* config/vx.exp, config/vxworks.exp, config/vxworks29k.exp: Delete
files.
* gdb.base/a2-run.exp: Remove all code guarded by istarget
"*-*-vxworks*" throughout.
* gdb.base/break.exp: Likewise.
* gdb.base/default.exp: Likewise.
* gdb.base/scope.exp: Likewise.
* gdb.base/sepdebug.exp: Likewise.
* gdb.base/break.c: Remove all code guarded by #ifdef vxworks
throughout.
* gdb.base/run.c: Likewise.
* gdb.base/sepdebug.c: Likewise.
* gdb.hp/gdb.aCC/run.c: Likewise.
* gdb.reverse/until-reverse.c: Likewise.
* lib/gdb.exp (gdb_compile): Remove is_vxworks branch.
Yao Qi [Thu, 28 Aug 2014 13:27:40 +0000 (21:27 +0800)]
Another board file for remote host
In the recent review to my patch about copying files to remote host,
we find that we need a board file which is more closely mapped real
remote host testing to improve coverage. With the board file
local-remote-host-native.exp, DejaGNU copies files to
$build/gdb/testsuite/remote-host to emulate the effect of remote host.
Is it OK?
gdb/testsuite:
2014-09-16 Yao Qi <yao@codesourcery.com>
* boards/local-remote-host-native.exp: New file.
Kuan-Lin Chen [Thu, 11 Sep 2014 06:25:05 +0000 (14:25 +0800)]
NDS32: Code refactoring of relaxation.
Refactor each relaxation pattern to raise the maintainability.
In origin, all patterns is analysed in nds32_elf_relax_section,
so it is hard to debug and maintain. Therefore, we classify all
patterns into different functions in this patch.
Moreover, we adjust all optimizations into nds32_elf_relax_section
to take these optimizations in turn. This can promise all relaxation
being done after calling gld${EMULATION_NAME}_after_allocation.
Kuan-Lin Chen [Wed, 10 Sep 2014 01:46:32 +0000 (09:46 +0800)]
NDS32/opcodes: Add audio ISA extension and modify the disassemble implemnt.
First, add nds32 audio ISA extension including opcodes and registers.
Second, redesign the disassemble implement.
The original disassemble decode instruction opcode using switch-case.
It is hard to synchronize when adding new instructions.
Therefore, the new implement reuses nds32_opcodes to dump the instructions.
Alan Modra [Tue, 16 Sep 2014 00:00:53 +0000 (09:30 +0930)]
daily update
Omair Javaid [Wed, 13 Aug 2014 13:12:14 +0000 (18:12 +0500)]
Implement support for recording vector data transfer instructions
gdb:
2014-08-13 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (arm_record_vdata_transfer_insn): Added record handler for
vector data transfer instructions.
(arm_record_coproc_data_proc): Updated.
Omair Javaid [Wed, 10 Sep 2014 11:29:04 +0000 (16:29 +0500)]
Implement support for recording extension register ld/st insn
gdb:
2014-08-13 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (arm_record_asimd_vfp_coproc): Replace stub handler with
arm_record_exreg_ld_st_insn.
(arm_record_exreg_ld_st_insn): Add record handler for ex-register
load/store insns.
Omair Javaid [Wed, 13 Aug 2014 13:12:12 +0000 (18:12 +0500)]
Implement support for recording VFP data processing instructions
gdb:
2014-08-13 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (arm_record_coproc_data_proc): Updated.
(arm_record_vfp_data_proc_insn): Added record handler for VFP data
processing instructions.
Omair Javaid [Wed, 10 Sep 2014 11:15:49 +0000 (16:15 +0500)]
Implement support for recording thumb2 ASIMD struct ld/st insns
gdb:
2014-08-13 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (thumb2_record_asimd_struct_ld_st): Add record handler
for advance SIMD struct ld/st insn.
(thumb2_record_decode_insn_handler): Replace stub handler with
thumb2_record_asimd_struct_ld_st.
Omair Javaid [Thu, 28 Aug 2014 09:50:06 +0000 (14:50 +0500)]
Implement support for recording arm/thumb mode coprocessor instructions
gdb:
2014-08-13 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (arm_record_coproc_data_proc): Add record handler stubs
for asimd, vfp and coprocessor insns.
(arm_record_asimd_vfp_coproc): Add record handler for asimd, vfp
and coprocessor insns.
(thumb2_record_coproc_insn): New function.
(thumb2_record_decode_insn_handler): Update coprocessor insns record
handlers.
(decode_insn): Install arm_record_asimd_vfp_coproc as handler for
opcode 110 insns.
H.J. Lu [Mon, 15 Sep 2014 15:41:40 +0000 (08:41 -0700)]
Rename OPTION_omit_lock_prefix to OPTION_OMIT_LOCK_PREFIX
* config/tc-i386.c (OPTION_omit_lock_prefix): Renamed to ...
(OPTION_OMIT_LOCK_PREFIX): This.
(md_longopts): Updated.
(md_parse_option): Likewise.
Chen Gang [Mon, 15 Sep 2014 12:58:29 +0000 (13:58 +0100)]
This fixes a typo in a previous commit.
(find_abstract_instance_name): Use 'form' instead of
'name' for the typo issue, which related with commit
60d77146a249ae9b51d7ce98930cdbedb2cfa352.
Andrew Bennett [Wed, 10 Sep 2014 10:32:01 +0000 (11:32 +0100)]
Add support for MIPS R6.
bfd/
* aoutx.h (NAME (aout, machine_type)): Add mips32r6 and mips64r6.
* archures.c (bfd_architecture): Likewise.
* bfd-in2.h (bfd_architecture): Likewise.
(bfd_reloc_code_real): Add relocs BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
BFD_RELOC_MIPS_19_PCREL_S2.
* cpu-mips.c (arch_info_struct): Add mips32r6 and mips64r6.
* elf32-mips.c: Define relocs R_MIPS_PC21_S2, R_MIPS_PC26_S2
R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
BFD_RELOC_LO16_PCREL.
* elf64-mips.c: Define REL, and RELA relocations R_MIPS_PC21_S2,
R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16
and R_MIPS_PCLO16.
(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
BFD_RELOC_LO16_PCREL.
* elfn32-mips.c: Likewise.
* elfxx-mips.c (MIPSR6_P): New define.
(mipsr6_exec_plt_entry): New array.
(hi16_reloc_p): Add support for R_MIPS_PCHI16.
(lo16_reloc_p): Add support for R_MIPS_PCLO16.
(aligned_pcrel_reloc_p): New function.
(mips_elf_relocation_needs_la25_stub): Add support for relocs:
R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
(mips_elf_calculate_relocation): Add support for relocs:
R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2,
R_MIPS_PCHI16 and R_MIPS_PCLO16.
(_bfd_elf_mips_mach): Add support for mips32r6 and mips64r6.
(mips_elf_add_lo16_rel_addend): Add support for R_MIPS_PCHI16.
(_bfd_mips_elf_check_relocs): Add support for relocs:
R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
(_bfd_mips_elf_relocate_section): Add a check for unaligned
pc relative relocs.
(_bfd_mips_elf_finish_dynamic_symbol): Add support for MIPS r6
plt entry.
(mips_set_isa_flags): Add support for mips32r6 and mips64r6.
(_bfd_mips_elf_print_private_bfd_data): Likewise.
(mips_32bit_flags_p): Add support for mips32r6.
* libbfd.h (bfd_reloc_code_real_names): Add entries for
BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2,
BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2.
* reloc.c: Document relocs BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
BFD_RELOC_MIPS_19_PCREL_S2.
binutils/
* readelf.c (get_machine_flags): Add support for mips32r6 and
mips64r6.
elfcpp/
* mips.h (E_MIPS_ARCH_32R6, E_MIPS_ARCH_64R6): New enum constants.
gas/
* config/tc-mips.c (mips_nan2008): New static global.
(mips_flag_nan2008): Removed.
(LL_SC_FMT): New define.
(COP12_FMT): Updated.
(ISA_IS_R6): New define.
(ISA_HAS_64BIT_REGS): Add mips64r6.
(ISA_HAS_DROR): Likewise.
(ISA_HAS_64BIT_FPRS): Add mips32r6 and mips64r6.
(ISA_HAS_ROR): Likewise.
(ISA_HAS_ODD_SINGLE_FPR): Likewise.
(ISA_HAS_MXHC1): Likewise.
(hilo_interlocks): Likewise.
(md_longopts): Likewise.
(ISA_HAS_LEGACY_NAN): New define.
(options): Add OPTION_MIPS32R6 and OPTION_MIPS64R6.
(mips_ase): Add field rem_rev.
(mips_ases): Updated to add which ISA an ASE was removed in.
(mips_isa_rev): Add support for mips32r6 and mips64r6.
(mips_check_isa_supports_ase): Add support to check if an ASE
has been removed in the specified MIPS ISA revision.
(validate_mips_insn): Skip '-' character.
(macro_build): Likewise.
(mips_check_options): Prevent R6 working with fp32, mips16,
micromips, or branch relaxation.
(file_mips_check_options): Set R6 floating point registers to
64 bit. Also deal with the nan2008 option.
(limited_pcrel_reloc_p): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
BFD_RELOC_LO16_PCREL.
(operand_reg_mask): Add support for OP_SAME_RS_RT, OP_CHECK_PREV
and OP_NON_ZERO_REG.
(match_check_prev_operand): New static function.
(match_same_rs_rt_operand): New static function.
(match_non_zero_reg_operand): New static function.
(match_operand): Added entries for: OP_SAME_RS_RT, OP_CHECK_PREV
and OP_NON_ZERO_REG.
(insns_between): Added case to deal with forbidden slots.
(append_insn): Added support for relocs: BFD_RELOC_MIPS_21_PCREL_S2
and BFD_RELOC_MIPS_26_PCREL_S2.
(match_insn): Add support for operands -A, -B, +' and +". Also
skip '-' character.
(mips_percent_op): Add entries for %pcrel_hi and %pcrel_lo.
(md_parse_option): Add support for mips32r6 and mips64r6. Also
update the nan option handling.
(md_pcrel_from): Add cases for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2.
(mips_force_relocation): Prevent forced relaxation for MIPS r6.
(md_apply_fix): Add support for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
BFD_RELOC_LO16_PCREL.
(s_mipsset): Add support for mips32r6 and mips64r6.
(s_nan): Update to support the new nan2008 framework.
(tc_gen_reloc): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
BFD_RELOC_LO16_PCREL.
(mips_elf_final_processing): Updated to use the mips_nan2008.
(mips_cpu_info_table): Add entries for mips32r6 and mips64r6.
(macro): Enable ldc2, sdc2, ll, lld, swc2, sc, scd, cache, pref
macros for R6.
(mips_fix_adjustable): Make PC relative R6 relocations relative
to the symbol and not the section.
* configure.ac: Add support for mips32r6 and mips64r6.
* configure: Regenerate.
* doc/c-mips.texi: Document the -mips32r6 and -mips64r6 command line
options.
* doc/as.texinfo: Likewise.
gas/testsuite/
* gas/mips/24k-triple-stores-1.s: If testing for r6 prevent
non-supported instructions from being tested.
* gas/mips/24k-triple-stores-2.s: Likewise.
* gas/mips/24k-triple-stores-3.s: Likewise.
* gas/mips/24k-triple-stores-6.s: Likewise.
* gas/mips/beq.s: Likewise.
* gas/mips/eva.s: Likewise.
* gas/mips/ld-zero-3.s: Likewise.
* gas/mips/mips32-cp2.s: Likewise.
* gas/mips/mips32.s: Likewise.
* gas/mips/mips4.s: Likewise.
* gas/mips/add.s: Don't test the add instructions if r6, and
add padding.
* gas/mips/add.d: Check for a triple dot not a nop at the end of the
disassembly output.
* gas/mips/micromips@add.d: Likewise.
* gas/mips/mipsr6@24k-branch-delay-1.d: New file.
* gas/mips/mipsr6@24k-triple-stores-1.d: New file.
* gas/mips/mipsr6@24k-triple-stores-2-llsc.d: New file.
* gas/mips/mipsr6@24k-triple-stores-2.d: New file.
* gas/mips/mipsr6@24k-triple-stores-3.d: New file.
* gas/mips/mipsr6@24k-triple-stores-6.d: New file.
* gas/mips/mipsr6@add.d: New file.
* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.l: New file.
* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.s: New file.
* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.l: New file.
* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.s: New file.
* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.l: New file.
* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.s: New file.
* gas/mips/mipsr6@beq.d: New file.
* gas/mips/mipsr6@bge.d: New file.
* gas/mips/mipsr6@bgeu.d: New file.
* gas/mips/mipsr6@blt.d: New file.
* gas/mips/mipsr6@bltu.d: New file.
* gas/mips/mipsr6@branch-misc-1.d: New file.
* gas/mips/mipsr6@branch-misc-2-64.d: New file.
* gas/mips/mipsr6@branch-misc-2pic-64.d: New file.
* gas/mips/mipsr6@branch-misc-4-64.d: New file.
* gas/mips/mipsr6@cache.d: New file.
* gas/mips/mipsr6@eva.d: New file.
* gas/mips/mipsr6@jal-svr4pic-noreorder.d: New file.
* gas/mips/mipsr6@jal-svr4pic.d: New file.
* gas/mips/mipsr6@ld-zero-2.d: New file.
* gas/mips/mipsr6@ld-zero-3.d: New file.
* gas/mips/mipsr6@loc-swap-dis.d: New file.
* gas/mips/mipsr6@mips32-cp2.d: New file.
* gas/mips/mipsr6@mips32-imm.d: New file.
* gas/mips/mipsr6@mips32.d: New file.
* gas/mips/mipsr6@mips32r2.d: New file.
* gas/mips/mipsr6@mips4-fp.d: New file.
* gas/mips/mipsr6@mips4-fp.l: New file.
* gas/mips/mipsr6@mips4-fp.s: New file.
* gas/mips/mipsr6@mips4.d: New file.
* gas/mips/mipsr6@mips5-fp.d: New file.
* gas/mips/mipsr6@mips5-fp.l: New file.
* gas/mips/mipsr6@mips5-fp.s: New file.
* gas/mips/mipsr6@mips64.d: New file.
* gas/mips/mipsr6@msa-branch.d: New file.
* gas/mips/mipsr6@msa.d: New file.
* gas/mips/mipsr6@pref.d: New file.
* gas/mips/mipsr6@relax-swap3.d: New file.
* gas/mips/r6-64-n32.d: New file.
* gas/mips/r6-64-n64.d: New file.
* gas/mips/r6-64-removed.l: New file.
* gas/mips/r6-64-removed.s: New file.
* gas/mips/r6-64.s: New file.
* gas/mips/r6-attr-none-double.d: New file.
* gas/mips/r6-n32.d: New file.
* gas/mips/r6-n64.d: New file.
* gas/mips/r6-removed.l: New file.
* gas/mips/r6-removed.s: New file.
* gas/mips/r6.d: New file.
* gas/mips/r6.s: New file.
* gas/mips/mipsr6@mips32-dsp.d: New file.
* gas/mips/mipsr6@mips32-dspr2.d: New file.
* gas/mips/mipsr6@mips32r2-ill.l: New file.
* gas/mips/mipsr6@mips32r2-ill.s: New file.
* gas/mips/cache.s: Add r6 instruction varients.
* gas/mips/mips.exp: Add support for the mips32r6 and mips64r6
architectures. Also prevent non r6 supported tests from running.
Finally, add in support for running the new r6 tests.
(run_dump_test_arch): Add support for mipsr6 tests.
(run_list_test_arch): Add support for using files of the
form arch@testname.l .
include/elf/
* mips.h: Add relocs: R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3,
R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
(E_MIPS_ARCH_32R6): New define.
(E_MIPS_ARCH_64R6): New define.
include/opcode/
* mips.h (mips_operand_type): Add new entries: OP_SAME_RS_RT,
OP_CHECK_PREV and OP_NON_ZERO_REG. Add descriptions for the MIPS R6
instruction arguments: -a, -b, -d, -s, -t, -u, -v, -w, -x, -y, -A, -B,
+I, +O, +R, +:, +\, +", +;
(mips_check_prev_operand): New struct.
(INSN2_FORBIDDEN_SLOT): New define.
(INSN_ISA32R6): New define.
(INSN_ISA64R6): New define.
(INSN_UPTO32R6): New define.
(INSN_UPTO64R6): New define.
(mips_isa_table): Add INSN_UPTO32R6 and INSN_UPTO64R6.
(ISA_MIPS32R6): New define.
(ISA_MIPS64R6): New define.
(CPU_MIPS32R6): New define.
(CPU_MIPS64R6): New define.
(cpu_is_member): Add cases for CPU_MIPS32R6, and CPU_MIPS64R6.
ld/
* ldmain.c (get_emulation): Add support for -mips32r6 and -mips64r6.
opcodes/
* mips-dis.c (mips_arch_choices): Add entries for mips32r6 and
mips64r6.
(parse_mips_dis_option): Allow MSA and virtualization support for
mips64r6.
(mips_print_arg_state): Add fields dest_regno and seen_dest.
(mips_seen_register): New function.
(print_insn_arg): Refactored code to use mips_seen_register
function. Add support for OP_SAME_RS_RT, OP_CHECK_PREV and
OP_NON_ZERO_REG. Changed OP_REPEAT_DEST_REG case to print out
the register rather than aborting.
(print_insn_args): Add length argument. Add code to correctly
calculate the instruction address for pc relative instructions.
(validate_insn_args): New static function.
(print_insn_mips): Prevent jalx disassembling for r6. Use
validate_insn_args.
(print_insn_micromips): Use validate_insn_args.
all the arguments are valid.
* mips-formats.h (PREV_CHECK): New define.
* mips-opc.c (decode_mips_operand): Add support for -a, -b, -d, -s,
-t, -u, -v, -w, -x, -y, -A, -B, +I, +O, +R, +:, +\, +", +;
(RD_pc): New define.
(FS): New define.
(I37): New define.
(I69): New define.
(mips_builtin_opcodes): Add MIPS R6 instructions. Exclude recoded
MIPS R6 instructions from MIPS R2 instructions.
Matthew Fortune [Mon, 15 Sep 2014 09:32:38 +0000 (10:32 +0100)]
Ensure softfloat and singlefloat take precedence in consistency checks
gas/
* tc-mips.c (check_fpabi): Move softfloat and singlefloat
checks higher.
gas/testsuite/
* gas/mips/attr-gnu-4-5-msingle-float.l: New file.
* gas/mips/attr-gnu-4-5-msingle-float.s: Likewise.
* gas/mips/attr-gnu-4-5-msoft-float.l: Likewise.
* gas/mips/attr-gnu-4-5-msoft-float.s: Likewise.
* gas/mips/attr-gnu-4-6-msingle-float.l: Update expected output.
* gas/mips/attr-gnu-4-6-msoft-float.l: Likewise.
* gas/mips/attr-gnu-4-7-msingle-float.l: Likewise.
* gas/mips/attr-gnu-4-7-msoft-float.l: Likewise.
* gas/mips/mips.exp: Update expected output for FP ABI 5,6,7.
Alan Modra [Mon, 15 Sep 2014 00:00:50 +0000 (09:30 +0930)]
daily update
Doug Evans [Sun, 14 Sep 2014 17:48:38 +0000 (10:48 -0700)]
Fix set up of queue-signal.exp test.
The test does a backtrace to see which thread (#2 or #3) is assigned
to which SIGUSR (1 or 2). If the main thread gets to all_threads_running
before the sigusr threads get to their entry point, then the function
name isn't in the backtrace and the test fails.
Alas this version of the code is within epsilon of what I started with,
and then over-simplified things.
Doug Evans [Sun, 14 Sep 2014 04:44:00 +0000 (21:44 -0700)]
New command queue-signal.
If I want to change the signalled state of multiple threads
it's a bit cumbersome to do with the "signal" command.
What you really want is a way to set the signal state of the
desired threads and then just do "continue".
This patch adds a new command, queue-signal, to accomplish this.
Basically "signal N" == "queue-signal N" + "continue".
That's not precisely true in that "signal" can be used to inject
any signal, including signals set to "nopass"; whereas "queue-signal"
just queues the signal as if the thread stopped because of it.
"nopass" handling is done when the thread is resumed which
"queue-signal" doesn't do.
One could add extra complexity to allow queue-signal to be used to
deliver "nopass" signals like the "signal" command. I have no current
need for it so in the interests of incremental complexity, I have
left such support out and just have the code flag an error if one
tries to queue a nopass signal.
gdb/ChangeLog:
* NEWS: Mention new "queue-signal" command.
* infcmd.c (queue_signal_command): New function.
(_initialize_infcmd): Add new queue-signal command.
gdb/doc/ChangeLog:
* gdb.texinfo (Signaling): Document new queue-signal command.
gdb/testsuite/ChangeLog:
* gdb.threads/queue-signal.c: New file.
* gdb.threads/queue-signal.exp: New file.
Alan Modra [Sun, 14 Sep 2014 00:01:10 +0000 (09:31 +0930)]
daily update
Doug Evans [Sat, 13 Sep 2014 23:00:13 +0000 (16:00 -0700)]
* linux-nat.c (wait_lwp): Add debugging printf.
(linux_nat_wait_1): Ditto.
Doug Evans [Sat, 13 Sep 2014 22:52:15 +0000 (15:52 -0700)]
Pass plain-text prompt to with_gdb_prompt.
I had occasion to use with_gdb_prompt in a test for the patch for PR 17314
and was passing the plain text prompt as the value, "(top-gdb)",
instead of a regexp, "\(top-gdb\)" (expressed as "\\(top-gdb\\)" in TCL).
I then discovered that in order to restore the prompt gdb passes the
original value of $gdb_prompt to "set prompt", which works because
"set prompt \(gdb\) " is equivalent to "set prompt (gdb) ".
Perhaps I'm being overly cautious but this feels a bit subtle,
but at any rate as an API choice I'd much rather pass the plain text
form to with_gdb_prompt.
I also discovered that the initial value of gdb_prompt is set in
two places to two different values.
At the global level gdb.exp sets it to "\[(\]gdb\[)\]"
and default_gdb_init sets it to "\\(gdb\\)".
The former form is undesirable as an argument to "set prompt",
but it's not clear to me that just deleting this code won't break
anything. Thus I just changed the value to be consistent and added
a comment.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_prompt): Add comment and change initial value to
be consistent with what default_gdb_init uses.
(with_gdb_prompt): Change form of PROMPT argument from a regexp to
the plain text of the prompt. Add some logging printfs.
* gdb.perf/disassemble.exp: Update call to with_gdb_prompt.
Alan Modra [Sat, 13 Sep 2014 06:24:40 +0000 (15:54 +0930)]
Fix some ChangeLog typos
Alan Modra [Sat, 13 Sep 2014 00:02:29 +0000 (09:32 +0930)]
daily update
Pedro Alves [Fri, 12 Sep 2014 21:16:31 +0000 (22:16 +0100)]
after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test
See:
https://sourceware.org/ml/gdb-patches/2014-09/msg00404.html
We have a number of places that do gdb_run_cmd followed by gdb_expect,
when it would be better to use gdb_test_multiple or gdb_test.
This converts all that "grep gdb_run_cmd -A 2 | grep gdb_expect"
found.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/testsuite/
2014-09-12 Pedro Alves <palves@redhat.com>
* gdb.arch/gdb1558.exp: Replace uses of gdb_expect after
gdb_run_cmd with gdb_test_multiple or gdb_test throughout.
* gdb.arch/i386-size-overlap.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.
* gdb.arch/i386-unwind.exp: Likewise.
* gdb.base/a2-run.exp: Likewise.
* gdb.base/break.exp: Likewise.
* gdb.base/charset.exp: Likewise.
* gdb.base/chng-syms.exp: Likewise.
* gdb.base/commands.exp: Likewise.
* gdb.base/dbx.exp: Likewise.
* gdb.base/find.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/jit-simple.exp: Likewise.
* gdb.base/reread.exp: Likewise.
* gdb.base/sepdebug.exp: Likewise.
* gdb.base/step-bt.exp: Likewise.
* gdb.cp/mb-inline.exp: Likewise.
* gdb.cp/mb-templates.exp: Likewise.
* gdb.objc/basicclass.exp: Likewise.
* gdb.threads/killed.exp: Likewise.
Pedro Alves [Fri, 12 Sep 2014 19:02:01 +0000 (20:02 +0100)]
[IRIX] eliminate deprecated_insert_raw_breakpoint uses
The IRIX support wants to set a breakpoint to be hit when the startup
phase is complete, which is where shared libraries have been mapped
in. AFAIU, for most IRIX ports, that location is the entry point.
For MIPS IRIX however, GDB needs to set a breakpoint earlier, in
__dbx_link, as explained by:
#ifdef SYS_syssgi
/* On mips-irix, we need to stop the inferior early enough during
the startup phase in order to be able to load the shared library
symbols and insert the breakpoints that are located in these shared
libraries. Stopping at the program entry point is not good enough
because the -init code is executed before the execution reaches
that point.
So what we need to do is to insert a breakpoint in the runtime
loader (rld), more precisely in __dbx_link(). This procedure is
called by rld once all shared libraries have been mapped, but before
the -init code is executed. Unfortuantely, this is not straightforward,
as rld is not part of the executable we are running, and thus we need
the inferior to run until rld itself has been mapped in memory.
For this, we trace all syssgi() syscall exit events. Each time
we detect such an event, we iterate over each text memory maps,
get its associated fd, and scan the symbol table for __dbx_link().
When found, we know that rld has been mapped, and that we can insert
the breakpoint at the symbol address. Once the dbx_link() breakpoint
has been inserted, the syssgi() notifications are no longer necessary,
so they should be canceled. */
proc_trace_syscalls_1 (pi, SYS_syssgi, PR_SYSEXIT, FLAG_SET, 0);
#endif
The loop in irix_solib_create_inferior_hook then runs until whichever
breakpoint is hit first, the one set by solib-irix.c or the one set by
procfs.c.
Note the comment in disable_break talks about __dbx_init, but I think
that's a typo for __dbx_link:
- /* Note that it is possible that we have stopped at a location that
- is different from the location where we inserted our breakpoint.
- On mips-irix, we can actually land in __dbx_init(), so we should
- not check the PC against our breakpoint address here. See procfs.c
- for more details. */
This looks very much like referring to the loop in
irix_solib_create_inferior_hook stopping at __dbx_link instead of at
the entry point.
What this patch does is convert these deprecated raw breakpoints to
standard solib_event breakpoints. When the first solib-event
breakpoint is hit, we delete all solib-event breakpoints. We do that
in the so_ops->handle_event hook.
This allows getting rid of the loop in irix_solib_create_inferior_hook
completely, which should allow properly handling signals and other
events in the early startup phase, like in SVR4.
Built on x86_64 Fedora 20 with --enable-targets=all (builds
solib-irix.c).
Joel tested that with an earlier version of this patch "info shared"
after starting a program gave the same list of shared libraries as
before.
gdb/ChangeLog:
2014-09-12 Pedro Alves <palves@redhat.com>
* breakpoint.c (remove_solib_event_breakpoints_at_next_stop)
(create_and_insert_solib_event_breakpoint): New functions.
* breakpoint.h (create_and_insert_solib_event_breakpoint)
(remove_solib_event_breakpoints_at_next_stop): New declarations.
* procfs.c (dbx_link_bpt_addr, dbx_link_bpt): Delete globals.
(remove_dbx_link_breakpoint): Delete function.
(insert_dbx_link_bpt_in_file): Use
create_and_insert_solib_event_breakpoint instead of
deprecated_insert_raw_breakpoint.
(procfs_wait): Don't check whether we hit __dbx_link here.
(procfs_mourn_inferior): Don't delete the __dbx_link breakpoint
here.
* solib-irix.c (base_breakpoint): Delete global.
(disable_break): Delete function.
(enable_break): Use create_solib_event_breakpoint
instead of deprecated_insert_raw_breakpoint.
(irix_solib_handle_event): New function.
(irix_solib_create_inferior_hook): Don't run the target or disable
the mapping-complete breakpoint here.
(_initialize_irix_solib): Install irix_solib_handle_event as
so_ops->handle_event hook.
Jose E. Marchesi [Fri, 12 Sep 2014 13:38:21 +0000 (15:38 +0200)]
gas: fix bumping to architectures >v9 in sparc64-* targets.
This patch fixes two related problems:
- By default gas is supposed to bump the current architecture
(starting with v6) as it finds "higher" instructions as the
assembling progresses. There are four possible cases depending on
the usage of the -A and -bump options:
(a) No -A and -bump are specified. In this case max_architecture
must be the highest architecture not conflicting with the
default architecture. The default opcode architecture is
indirectly set in configure.tgt and is "v9" in sparc64 systems
(from "v9-64"). Thus the maximum architecture in sparc64
systems must be "v9b". No warnings are echoed when the assembly
of an instruction bumps the current architecture.
(b) Only -bump is specified. This is like (a) but warnings are
always issued when the assembly of an instruction bumps the
current architecture.
(c) Only -A is specified. In this case bumping to a new
architecture is an error.
(d) Both -A and -bump are specified. In this case max_architecture
must be the highest architecture not conflicting with the
default architecture, but warnings are only to be issued when
bumping to an architecture higher than the architecture selected
in the -A option.
`max_architecture' is a global variable defined in tc-sparc.c which
is initialized to the opcode architecture corresponding to the
default architecture ("sparclite" for sparc-* targets and "v9" for
sparc64-* targets). Then in `md_begin' it is set to the highest
non-conflicting architecture, but only when both -A and -bump are
specified.
Thus (a) does not work:
$ echo "fzero %f0" | as
{standard input}: Assembler messages:
{standard input}:1: Error: Architecture mismatch on "fzero".
{standard input}:1: (Requires v9a|v9b; requested architecture is v9.)
Neither (b):
$ echo "fzero %f0" | as -bump
{standard input}: Assembler messages:
{standard input}:1: Error: Architecture mismatch on "fzero".
{standard input}:1: (Requires v9a|v9b; requested architecture is v9.)
Only (d) does:
$ echo "fzero %f0" | as -Av9 -bump
{standard input}: Assembler messages:
{standard input}:1: Warning: architecture bumped from "v6" to "v9a" on "fzero"
This patch fixes that function to "upgrade" `max_architecture' also
in the (a) and (b) cases.
Note that this problem becomes apparent only in sparc64-* targets
because in sparc-* targets the default architecture is the "higher"
among the 32bit architectures ("sparclite").
- Gas maintains a set of hardware capabilities associated with each
gas architecture, in `sparc_arch_table'. On the other hand
libopcodes maintains a set of hardware capabilities needed by each
individual sparc instruction.
When an instruction is assembled in `sparc_ip' gas checks for the
presence of the hardware capabilities required by the instruction,
emitting an error if some capability is missing.
However, this mechanism does not work properly if the current
architecture is bumped due to an instruction requiring new hw
capabilities not present on either the default architecture or an
architecture specified with -A:
$ echo "fzero %f0" | as -bump
{standard input}: Assembler messages:
{standard input}:1: Warning: architecture bumped from "v6" to "v9a" on "fzero"
{standard input}:1: Error: Hardware capability "vis" not enabled for "fzero".
This patch fixes this by adding the set of required hw caps of an
instruction if it triggers an architecture bump.
The patch has been tested in sparc64-unknown-linux-gnu.
gas/ChangeLog:
2014-09-12 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_ip): Update the set of allowed hwcaps
when bumping the current architecture.
(md_begin): Adjust the highetst architecture level also when a
specific architecture is not requested.
Andrew Bennett [Wed, 10 Sep 2014 11:41:28 +0000 (12:41 +0100)]
Add mips*-img-elf* target triple.
/
* configure.ac: Add mips*-img-elf* target triple.
* configure: Regenerate.
bfd/
* config.bfd: Add mips*-img-elf* target triple.
gas/
* configure.tgt: Add mips*-img-elf* target triple.
gas/testsuite/
* gas/mips/mips.exp: Add mips*-img-elf* target triple.
binutils/testsuite/
* binutils-all/objcopy.exp: Add mips*-img-elf* target triple.
* binutils-all/readelf.exp: Likewise.
ld/
* configure.tgt: Add mips*-img-elf* target triple.
ld/testsuite/
* ld-mips-elf/mips-elf.exp: Add support for mips*-img-elf* target
triple.
Edjunior Barbosa Machado [Fri, 12 Sep 2014 12:20:25 +0000 (09:20 -0300)]
PR tdep/17379: Fix internal-error when stack pointer is invalid.
The problem is that rs6000_frame_cache attempts to read the stack backchain via
read_memory_unsigned_integer, which throws an exception if the stack pointer is
invalid. With this patch, it calls safe_read_memory_integer instead, which
doesn't throw an exception and allows for safe handling of that situation.
gdb/ChangeLog
2014-09-12 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
PR tdep/17379
* rs6000-tdep.c (rs6000_frame_cache): Use safe_read_memory_integer
instead of read_memory_unsigned_integer.
gdb/testcase/ChangeLog
2014-09-12 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
PR tdep/17379
* gdb.arch/powerpc-stackless.S: New file.
* gdb.arch/powerpc-stackless.exp: New file.
Jan Kratochvil [Fri, 12 Sep 2014 11:39:04 +0000 (13:39 +0200)]
testsuite: Fix runaway attach processes
I have started seeing occasional runaway 'attach' processes these days.
I cannot be certain it is really caused by this patch, for example
grep 'FAIL.*cmdline attach run' does not show anything in my logs.
But as I remember this 'attach' runaway process always happened in GDB (but
I do not remember it in the past months) I think it would be most safe to just
solve it forever by [attached].
gdb/testsuite/ChangeLog
2014-09-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach.c: Include unistd.h.
(main): Call alarm. Add label postloop.
* gdb.base/attach.exp (do_attach_tests): Use gdb_get_line_number,
gdb_breakpoint, gdb_continue_to_breakpoint.
(test_command_line_attach_run): Kill ${testpid} in one exit path.
Gary Benson [Fri, 12 Sep 2014 09:57:46 +0000 (10:57 +0100)]
Clarify GDBSERVER use in linux-waitpid.c
This commit makes linux-waitpid.c include common-defs.h. GDB's
inclusion of defs.h is removed, but gdbserver's inclusion of
server.h remains to support some gdbserver-specific debug code
that cannot presently be merged. A new FIXME documents this.
gdb/ChangeLog:
* nat/linux-waitpid.c: Include common-defs.h.
[GDBSERVER]: Add FIXME comment.
[!GDBSERVER]: Don't include defs.h or signal.h.
(linux_debug) [!GDBSERVER]: Remove empty block.
Gary Benson [Fri, 12 Sep 2014 09:11:42 +0000 (10:11 +0100)]
Remove GDBSERVER uses from x86-dregs.c
This commit makes nat/x86-dregs.c include common-defs.h rather than
defs.h or server.h. An extra header required including in order to
support this change.
gdb/ChangeLog:
* nat/x86-dregs.c: Include common-defs.h and break-common.h.
Don't include defs.h or server.h.
Gary Benson [Fri, 12 Sep 2014 09:11:42 +0000 (10:11 +0100)]
Remove GDBSERVER uses from linux-btrace.c
This commit makes nat/linux-btrace.c include common-defs.h rather
than defs.h or server.h. A couple of minor changes were required
to support this change.
gdb/ChangeLog:
* nat/linux-btrace.c: Include common-defs.h.
Don't include defs.h, server.h or gdbthread.h.
* nat/linux-btrace.h (struct target_ops): New forward declaration.
Gary Benson [Fri, 12 Sep 2014 09:11:42 +0000 (10:11 +0100)]
Include common-defs.h instead of defs.h/server.h in shared code
This commit makes 19 of the 22 shared .c files in common, nat and
target include common-defs.h instead of defs.h/server.h. The
remaining three files need slight extra work and are dealt with
in separate commits.
gdb/ChangeLog:
* common/agent.c: Include common-defs.h.
Don't include defs.h or server.h.
* common/buffer.c: Likewise.
* common/common-debug.c: Likewise.
* common/common-utils.c: Likewise.
* common/errors.c: Likewise.
* common/filestuff.c: Likewise.
* common/format.c: Likewise.
* common/gdb_vecs.c: Likewise.
* common/print-utils.c: Likewise.
* common/ptid.c: Likewise.
* common/rsp-low.c: Likewise.
* common/signals.c: Likewise.
* common/vec.c: Likewise.
* common/xml-utils.c: Likewise.
* nat/linux-osdata.c: Likewise.
* nat/linux-procfs.c: Likewise.
* nat/linux-ptrace.c: Likewise.
* nat/mips-linux-watch.c: Likewise.
* target/waitstatus.c: Likewise.
Gary Benson [Fri, 12 Sep 2014 09:11:42 +0000 (10:11 +0100)]
Introduce common-regcache.h
This introduces common-regcache.h. This contains two functions that
allow nat/linux-btrace.c to be simplified. A better long term
solution would be unify the regcache code, but this is sufficient for
now.
gdb/ChangeLog:
* common/common-regcache.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add common/common-regcache.h.
* regcache.h: Include common-regcache.h.
(regcache_read_pc): Don't declare.
* regcache.c (get_thread_regcache_for_ptid): New function.
* nat/linux-btrace.c: Don't include regcache.h.
Include common-regcache.h.
(perf_event_read_bts): Use get_thread_regcache_for_ptid.
gdb/gdbserver/ChangeLog:
* regcache.h: Include common-regcache.h.
(regcache_read_pc): Don't declare.
* regcache.c (get_thread_regcache_for_ptid): New function.
Alan Modra [Fri, 12 Sep 2014 00:16:30 +0000 (09:46 +0930)]
Fix tc-i386.c -Werror=logical-not-parentheses error
* config/tc-i386.c (match_template): Remove redundant "!!" testing
single-bit bitfields.
(build_modrm_byte): Don't compare single-bit bitfields to "1".
Alan Modra [Fri, 12 Sep 2014 00:05:42 +0000 (09:35 +0930)]
Test for overflow in eh_frame_hdr entries and for overlapping FDEs
With larger binaries on 64-bit systems, or indeed just binaries that
have a large gap between text and data, it is possible for the
.eh_frame_hdr lookup table entry values to overflow a signed 32-bit
relative offset. It is also a requirement for the glibc FDE lookup
code that only one FDE claim to cover any given address.
* elf-bfd.h (struct eh_frame_array_ent): Add "range".
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Stash address
range of FDEs to hdr_info->array.
(_bfd_elf_write_section_eh_frame_hdr): Report overflow in
.eh_frame_hdr entries, and overlapping FDEs.
Alan Modra [Fri, 12 Sep 2014 00:01:26 +0000 (09:31 +0930)]
daily update
Thomas Schwinge [Thu, 11 Sep 2014 20:30:23 +0000 (22:30 +0200)]
Make gdb/regcache.h self-contained.
gdb/
* regcache.h (struct regset): Declare.
Commit
0b3092721e5cfa1697f1dafe81efefdbb0236f21 added uses of struct regset to
gdb/regcache.h, but that struct is not declared in this file, and, as it
happens, also nowhere else in the #include chain on x86 GNU/Hurd. This results
in warnings/errors such as:
gcc-4.8 [...] ../../W._C._Handy/gdb/gdb.c
In file included from ./nm.h:25:0,
from ../../W._C._Handy/gdb/defs.h:454,
from ../../W._C._Handy/gdb/gdb.c:19:
../../W._C._Handy/gdb/regcache.h:190:9: warning: 'struct regset' declared inside parameter list [enabled by default]
size_t size);
^
../../W._C._Handy/gdb/regcache.h:190:9: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
../../W._C._Handy/gdb/regcache.h:193:10: warning: 'struct regset' declared inside parameter list [enabled by default]
int regnum, void *buf, size_t size);
^
Pedro Alves [Thu, 11 Sep 2014 12:04:15 +0000 (13:04 +0100)]
gdb/17347 - Regression: GDB stopped on run with attached process
Doing:
gdb --pid=PID -ex run
Results in GDB getting a SIGTTIN, and thus ending stopped. That's
usually indicative of a missing target_terminal_ours call.
E.g., from the PR:
$ sleep 1h & p=$!; sleep 0.1; gdb -batch sleep $p -ex run
[1] 28263
[1] Killed sleep 1h
[2]+ Stopped gdb -batch sleep $p -ex run
The workaround is doing:
gdb -ex "attach $PID" -ex "run"
instead of
gdb [-p] $PID -ex "run"
With the former, gdb waits for the attach command to complete before
moving on to the "run" command, because the interpreter is in sync
mode at this point, within execute_command. But for the latter,
attach_command is called directly from captured_main, and thus misses
that waiting. IOW, "run" is running before the attach continuation
has run, before the program stops and attach completes. The broken
terminal settings are just one symptom of that. Any command that
queries or requires input results in the same.
The fix is to wait in catch_command_errors (which is specific to
main.c nowadays), just like we wait in execute_command.
gdb/ChangeLog:
2014-09-11 Pedro Alves <palves@redhat.com>
PR gdb/17347
* main.c: Include "infrun.h".
(catch_command_errors, catch_command_errors_const): Wait for the
foreground command to complete.
* top.c (maybe_wait_sync_command_done): New function, factored out
from ...
(maybe_wait_sync_command_done): ... here.
* top.h (maybe_wait_sync_command_done): New declaration.
gdb/testsuite/ChangeLog:
2014-09-11 Pedro Alves <palves@redhat.com>
PR gdb/17347
* lib/gdb.exp (gdb_spawn_with_cmdline_opts): New procedure.
* gdb.base/attach.exp (test_command_line_attach_run): New
procedure.
(top level): Call it.