Yao Qi [Wed, 18 Jun 2014 14:03:20 +0000 (22:03 +0800)]
Remove any_running
Function any_running isn't used. This patch is to remove it.
Rebuild GDB for linux and mingw.
gdb:
2014-06-19 Yao Qi <yao@codesourcery.com>
* gdbthread.h (any_running): Remove the declaration.
* thread.c (any_running): Remove.
Yao Qi [Wed, 18 Jun 2014 14:00:54 +0000 (22:00 +0800)]
Use enum thread_state
This patch is to change field state's type to 'enum thread_state', and
replace RUNNING with THREAD_RUNNING and STOPPED with THREAD_STOPPED
respectively in comments.
gdb:
2014-06-19 Yao Qi <yao@codesourcery.com>
* gdbthread.h (struct thread_info) <state>: Change its type to
'enum thread_state'. Update comments.
Pedro Alves [Thu, 19 Jun 2014 10:59:03 +0000 (11:59 +0100)]
Fix next over threaded execl with "set scheduler-locking step".
Running gdb.threads/thread-execl.exp with scheduler-locking set to
"step" reveals a problem:
(gdb) next^M
[Thread 0x7ffff7fda700 (LWP 27168) exited]^M
[New LWP 27168]^M
[Thread 0x7ffff74ee700 (LWP 27174) exited]^M
process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error)
The assertion is correct. The issue is that GDB is mistakenly trying
to switch back to an exited thread, that was previously stepping when
it exited. This is exactly the sort of thing the test wants to make
sure doesn't happen:
# Now set a breakpoint at `main', and step over the execl call. The
# breakpoint at main should be reached. GDB should not try to revert
# back to the old thread from the old image and resume stepping it
We don't see this bug with schedlock off only because a different
sequence of events makes GDB manage to delete the thread instead of
marking it exited.
This particular internal error can be fixed by making the loop over
all threads in switch_back_to_stepped_thread skip exited threads.
But, looking over other ALL_THREADS users, all either can or should be
skipping exited threads too. So for simplicity, this patch replaces
ALL_THREADS with a new macro that skips exited threads itself, and
updates everything to use it.
Tested on x86_64 Fedora 20.
gdb/
2014-06-19 Pedro Alves <palves@redhat.com>
* gdbthread.h (ALL_THREADS): Delete.
(ALL_NON_EXITED_THREADS): New macro.
* btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* infrun.c (find_thread_needs_step_over)
(switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS
instead of ALL_THREADS.
* record-btrace.c (record_btrace_open)
(record_btrace_stop_recording, record_btrace_close)
(record_btrace_is_replaying, record_btrace_resume)
(record_btrace_find_thread_to_move, record_btrace_wait): Likewise.
* remote.c (append_pending_thread_resumptions): Likewise.
* thread.c (thread_apply_all_command): Likewise.
gdb/testsuite/
2014-06-19 Pedro Alves <palves@redhat.com>
* gdb.threads/thread-execl.exp (do_test): New procedure, factored
out from ...
(top level): ... here. Iterate running tests under different
scheduler-locking settings.
Gary Benson [Thu, 19 Jun 2014 09:54:15 +0000 (10:54 +0100)]
Directly call i386-dregs functions
Three target_ops functions in i386-nat.c call other local target_ops
functions. This commit changes those functions to call the functions
in i386-dregs.c directly.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_stopped_by_watchpoint):
Use i386_dr_stopped_by_watchpoint.
(i386_insert_hw_breakpoint): Use i386_dr_insert_watchpoint.
(i386_remove_hw_breakpoint): Use i386_dr_remove_watchpoint.
Gary Benson [Thu, 19 Jun 2014 09:53:12 +0000 (10:53 +0100)]
Create nat/i386-dregs.c
This commit moves code to be shared from i386-{nat,low}.[ch]
into a new file, nat/i386-dregs.c.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* nat/i386-dregs.c: New file.
* Makefile.in (i386-dregs.o): New rule.
* config/i386/cygwin.mh (NATDEPFILES): Add i386-dregs.o.
* config/i386/cygwin64.mh (NATDEPFILES): Likewise.
* config/i386/darwin.mh (NATDEPFILES): Likewise.
* config/i386/fbsd.mh (NATDEPFILES): Likewise.
* config/i386/fbsd64.mh (NATDEPFILES): Likewise.
* config/i386/go32.mh (NATDEPFILES): Likewise.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/i386/mingw.mh (NATDEPFILES): Likewise.
* config/i386/mingw64.mh (NATDEPFILES): Likewise.
* i386-nat.h (debug_hw_points): New declaration.
* i386-nat.c (breakpoint.h): Remove include.
(command.h): Likewise.
(target.h): Likewise.
(gdb_assert.h): Likewise.
(debug_hw_points): Made nonstatic.
(debug_printf): Now in i386-dregs.c.
(TARGET_HAS_DR_LEN_8): Likewise.
(DR_CONTROL_SHIFT): Likewise.
(DR_CONTROL_SIZE): Likewise.
(DR_RW_EXECUTE): Likewise.
(DR_RW_WRITE): Likewise.
(DR_RW_READ): Likewise.
(DR_RW_IORW): Likewise.
(DR_LEN_1): Likewise.
(DR_LEN_2): Likewise.
(DR_LEN_4): Likewise.
(DR_LEN_8): Likewise.
(DR_LOCAL_ENABLE_SHIFT): Likewise.
(DR_GLOBAL_ENABLE_SHIFT): Likewise.
(DR_ENABLE_SIZE): Likewise.
(DR_LOCAL_SLOWDOWN): Likewise.
(DR_GLOBAL_SLOWDOWN): Likewise.
(DR_CONTROL_RESERVED): Likewise.
(I386_DR_CONTROL_MASK): Likewise.
(I386_DR_VACANT): Likewise.
(I386_DR_LOCAL_ENABLE): Likewise.
(I386_DR_GLOBAL_ENABLE): Likewise.
(I386_DR_DISABLE): Likewise.
(I386_DR_SET_RW_LEN): Likewise.
(I386_DR_GET_RW_LEN): Likewise.
(I386_DR_WATCH_HIT): Likewise.
(i386_wp_op_t): Likewise.
(i386_show_dr): Likewise.
(i386_length_and_rw_bits): Likewise.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.
(i386_update_inferior_debug_regs): Likewise.
(i386_insert_watchpoint): Use i386_dr_insert_watchpoint.
(i386_remove_watchpoint): Use i386_dr_remove_watchpoint.
(i386_region_ok_for_watchpoint):
Use i386_dr_region_ok_for_watchpoint.
(i386_stopped_data_address): Use i386_dr_stopped_data_address.
gdb/gdbserver/
2014-06-19 Gary Benson <gbenson@redhat.com>
* Makefile.in (i386-dregs.o): New rule.
* configure.srv: Add i386-dregs.o to all targets using i386-low.o.
* i386-low.c (target.h): Remove include.
(TARGET_HAS_DR_LEN_8): Now in i386-dregs.c.
(DR_CONTROL_SHIFT): Likewise.
(DR_CONTROL_SIZE): Likewise.
(DR_RW_EXECUTE): Likewise.
(DR_RW_WRITE): Likewise.
(DR_RW_READ): Likewise.
(DR_RW_IORW): Likewise.
(DR_LEN_1): Likewise.
(DR_LEN_2): Likewise.
(DR_LEN_4): Likewise.
(DR_LEN_8): Likewise.
(DR_LOCAL_ENABLE_SHIFT): Likewise.
(DR_GLOBAL_ENABLE_SHIFT): Likewise.
(DR_ENABLE_SIZE): Likewise.
(DR_LOCAL_SLOWDOWN): Likewise.
(DR_GLOBAL_SLOWDOWN): Likewise.
(DR_CONTROL_RESERVED): Likewise.
(I386_DR_CONTROL_MASK): Likewise.
(I386_DR_VACANT): Likewise.
(I386_DR_LOCAL_ENABLE): Likewise.
(I386_DR_GLOBAL_ENABLE): Likewise.
(I386_DR_DISABLE): Likewise.
(I386_DR_SET_RW_LEN): Likewise.
(I386_DR_GET_RW_LEN): Likewise.
(I386_DR_WATCH_HIT): Likewise.
(i386_wp_op_t): Likewise.
(i386_show_dr): Likewise.
(i386_length_and_rw_bits): Likewise.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.
i386_update_inferior_debug_regs(): Likewise.
(i386_dr_insert_watchpoint): Likewise.
(i386_dr_remove_watchpoint): Likewise.
(i386_dr_region_ok_for_watchpoint): Likewise.
(i386_dr_stopped_data_address): Likewise.
(i386_dr_stopped_by_watchpoint): Likewise.
Gary Benson [Thu, 19 Jun 2014 09:50:20 +0000 (10:50 +0100)]
Refactor i386_{insert,remove}_hw_breakpoint
This commit refactors i386_{insert,remove}_hw_breakpoint
to call i386_{insert,remove}_watchpoint rather than
duplicating functionality.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_insert_hw_breakpoint): Use
i386_insert_watchpoint.
(i386_remove_hw_breakpoint): Use i386_remove_watchpoint.
Gary Benson [Wed, 18 Jun 2014 14:17:02 +0000 (15:17 +0100)]
Partially revert
4be83cc2b28ea09aa8ff789839e6520df60836f8
The above commit did two things:
1) A number of functions were renamed and made nonstatic.
2) A number of other functions were renamed only.
This commit reverts #1 but not #2. In addition, prototypes for
functions now remade static have been removed from i386-dregs.h.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_dr_show): Renamed to
i386_show_dr and made static. All uses updated.
(i386_dr_length_and_rw_bits): Renamed to
i386_length_and_rw_bits and made static.
All uses updated.
(i386_dr_insert_aligned_watchpoint): Renamed to
i386_insert_aligned_watchpoint and made static.
All uses updated.
(i386_dr_remove_aligned_watchpoint): Renamed to
i386_remove_aligned_watchpoint and made static.
All uses updated.
(i386_dr_update_inferior_debug_regs): Renamed to
i386_update_inferior_debug_regs and made static.
All uses updated.
* nat/i386-dregs.h (i386_dr_show): Removed.
(i386_dr_length_and_rw_bits): Likewise.
(i386_dr_insert_aligned_watchpoint): Likewise.
(i386_dr_remove_aligned_watchpoint): Likewise.
(i386_dr_update_inferior_debug_regs): Likewise.
gdb/gdbserver/
2014-06-19 Gary Benson <gbenson@redhat.com>
* i386-low.c (i386_dr_show): Renamed to
i386_show_dr and made static. All uses updated.
(i386_dr_length_and_rw_bits): Renamed to
i386_length_and_rw_bits and made static.
All uses updated.
(i386_dr_insert_aligned_watchpoint): Renamed to
i386_insert_aligned_watchpoint and made static.
All uses updated.
(i386_dr_remove_aligned_watchpoint): Renamed to
i386_remove_aligned_watchpoint and made static.
All uses updated.
(i386_dr_update_inferior_debug_regs): Renamed to
i386_update_inferior_debug_regs and made static.
All uses updated.
Gary Benson [Thu, 19 Jun 2014 08:13:57 +0000 (09:13 +0100)]
Demangler crash handler
This commit wraps calls to the demangler with a segmentation fault
handler. The first time a segmentation fault is caught a core file
is generated and the user is prompted to file a bug and offered the
choice to exit or to continue their GDB session. A maintainence
option is provided to allow the user to disable the crash handler
if required.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* configure.ac [AC_CHECK_FUNCS] <sigaltstack>: New check.
* configure: Regenerate.
* config.in: Likewise.
* main.c (signal.h): New include.
(setup_alternate_signal_stack): New function.
(captured_main): Call the above.
* cp-support.c (signal.h): New include.
(catch_demangler_crashes): New flag.
(SIGJMP_BUF): New define.
(SIGSETJMP): Likewise.
(SIGLONGJMP): Likewise.
(gdb_demangle_jmp_buf): New static global.
(gdb_demangle_attempt_core_dump): Likewise.
(gdb_demangle_signal_handler): New function.
(gdb_demangle): If catch_demangler_crashes is set, install the
above signal handler before calling bfd_demangle, and restore
the original signal handler afterwards. Display the offending
symbol and call demangler_warning the first time a segmentation
fault is caught.
(_initialize_cp_support): New maint set/show command.
gdb/doc/
2014-06-19 Gary Benson <gbenson@redhat.com>
* gdb.texinfo (Maintenance Commands): Document new
"maint set/show catch-demangler-crashes" option.
Gary Benson [Thu, 19 Jun 2014 08:12:26 +0000 (09:12 +0100)]
Refactor and expose core-dumping functionality
This commit exposes the functions that dump core outside utils.c.
can_dump_core gains a new parameter, "limit_kind", to allow either
the soft or hard limit to be checked, and its printing has separated
into the new function warn_cant_dump_core. The new function
can_dump_core_warn does what can_dump_core previously did (print and
warn).
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* utils.h (resource_limit_kind): New enum.
(can_dump_core): New declaration.
(warn_cant_dump_core): Likewise.
(dump_core): Likewise.
* utils.c (dump_core): Made nonstatic. Added new
parameter "limit_kind".
(can_dump_core): Made nonstatic. Moved printing code to...
(warn_cant_dump_core): New function.
(can_dump_core_warn): Likewise.
(internal_vproblem): Replace calls to can_dump_core with
calls to can_dump_core_warn. Supply new argument to each.
Gary Benson [Thu, 19 Jun 2014 08:10:44 +0000 (09:10 +0100)]
Add new internal problem for demangler warnings
This commit adds a new category of internal problem for demangler
warnings. Demangler warnings behave in much the same way as internal
warnings except that they do not create core files and no option to
change this is presented to the user.
gdb/
2014-06-19 Gary Benson <gbenson@redhat.com>
* utils.h (demangler_vwarning): New declaration.
(demangler_warning): Likewise.
* utils.c (struct internal_problem)
<user_settable_should_quit>: New field.
<user_settable_should_dump_core>: Likewise
(internal_error_problem): Add values for above new fields.
(internal_warning_problem): Likewise.
(demangler_warning_problem): New static global.
(demangler_vwarning): New function.
(demangler_warning): Likewise.
(add_internal_problem_command): Selectively add commands.
(_initialize_utils): New internal problem command.
* maint.c (maintenance_demangler_warning): New function.
(_initialize_maint_cmds): New command.
gdb/doc/
2014-06-19 Gary Benson <gbenson@redhat.com>
* gdb.texinfo (Maintenance Commands): Document new
"maint demangler-warning" command and new
"maint set/show demangler-warning" option.
Luis Machado [Thu, 19 Jun 2014 06:07:48 +0000 (07:07 +0100)]
The testcase was generating DW_AT_high_pc and DW_AT_low_pc entries
with type DW_FORM_string, which is wrong.
GDB was using that information to load data as strings, and then
proceeded to use the string pointers as addresses.
Even then, the test was passing just fine, because we were lucky
enough to have the low_pc string pointer smaller than the high_pc
string pointer.
Two issues are fixed. The first one is the DW_FORM_string type. The
second one is adjusting the addresses so that they are non-zero,
since GDB doesn't like seeing 0 in these fields due to a check
contained in dwarf2_get_pc_bounds:
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
return 0;
With both fixes, the testcase passes deterministically.
2014-06-19 Luis Machado <lgustavo@codesourcery.com>
* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
to DW_FORM_addr and use non-zero addresses.
Alan Modra [Thu, 19 Jun 2014 00:01:16 +0000 (09:31 +0930)]
daily update
DJ Delorie [Wed, 18 Jun 2014 21:16:30 +0000 (17:16 -0400)]
[rx] Make .B suffix optional when possible.
* config/rx-parse.y (BSET, BCLR, BTST, BNOT, BMCMD): Make .B
suffix optional.
Andreas Tobler [Wed, 18 Jun 2014 19:58:19 +0000 (21:58 +0200)]
ld/ARM: Add target arm*b-*-freebsd*, update target arm*-*-freebsd*.
ld/ChangeLog:
2014-06-18 Andreas Tobler <andreast@fgznet.ch>
* configure.tgt (arm*-*-freebsd*): Update targ_extra_emuls.
(arm*b-*-freebsd*): Add target.
* emulparams/armelfb_fbsd.sh: Added.
* emulparams/armelf_fbsd.sh: Updated.
* Makefile.am (ALL_EMULATION_SOURCES): Add earmelfb_fbsd.c.
* Makefile.in: Regenerate.
Tom Tromey [Wed, 11 Jun 2014 14:02:48 +0000 (08:02 -0600)]
make common_block const
This changes general_symbol_info to make "common_block" const.
2014-06-18 Tom Tromey <tromey@redhat.com>
* f-valprint.c (info_common_command_for_block): Update.
* symtab.h (struct general_symbol_info) <common_block>: Now
const.
Tom Tromey [Tue, 10 Jun 2014 19:11:19 +0000 (13:11 -0600)]
constify some blockvector APIs
Generally, the blockvector ought to be readonly. So, this patch makes
the blockvector const in the symtab, and also changes various
blockvector APIs to be const.
This patch has a couple of spots that cast away const. I consider
these to be ok because they occur in mdebugread and are used while
constructing the blockvector. I have added comments at these spots.
2014-06-18 Tom Tromey <tromey@redhat.com>
* symtab.h (struct symtab) <blockvector>: Now const.
* ada-lang.c (ada_add_global_exceptions): Update.
* buildsym.c (augment_type_symtab): Update.
* dwarf2read.c (dw2_lookup_symbol): Update.
* jit.c (finalize_symtab): Update.
* jv-lang.c (add_class_symtab_symbol): Update.
* mdebugread.c (parse_symbol, add_block, sort_blocks, new_symtab):
Update.
* objfiles.c (objfile_relocate1): Update.
* psymtab.c (lookup_symbol_aux_psymtabs)
(maintenance_check_psymtabs): Update.
* python/py-symtab.c (stpy_global_block, stpy_static_block):
Update.
* spu-tdep.c (spu_catch_start): Update.
* symmisc.c (dump_symtab_1): Update.
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_aux_objfile, lookup_symbol_aux_quick)
(basic_lookup_transparent_type_quick)
(basic_lookup_transparent_type, find_pc_sect_symtab)
(find_pc_sect_line, search_symbols): Update.
* block.c (find_block_in_blockvector): Make "bl" const.
(blockvector_for_pc_sect, blockvector_for_pc): Make return type
const.
(blockvector_contains_pc): Make "bv" const.
(block_for_pc_sect): Update.
* block.h (blockvector_for_pc, blockvector_for_pc_sect)
(blockvector_contains_pc): Update.
* breakpoint.c (resolve_sal_pc): Update.
* inline-frame.c (block_starting_point_at): Update.
Tom Tromey [Mon, 15 Apr 2013 16:22:12 +0000 (10:22 -0600)]
constify complete_line
This changes complete_line to take a const parameter.
2014-06-18 Tom Tromey <tromey@redhat.com>
* completer.c (complete_line): Make "line_buffer" const.
* completer.h (complete_line): Update.
Tom Tromey [Thu, 28 Mar 2013 17:09:08 +0000 (11:09 -0600)]
remove unneeded cast in symtab.c
This removes an unneeded const cast from symtab.c:add_macro_name.
2014-06-18 Tom Tromey <tromey@redhat.com>
* symtab.c (add_macro_name): Remove unneeded cast.
Tom Tromey [Wed, 27 Mar 2013 16:35:35 +0000 (10:35 -0600)]
constify parse_cli_boolean_value
This changes a parameter of parse_cli_boolean_value to be const.
2014-06-18 Tom Tromey <tromey@redhat.com>
* cli/cli-setshow.h (parse_cli_boolean_value): Update.
* cli/cli-setshow.c (parse_cli_boolean_value): Make "arg" const.
Tom Tromey [Tue, 10 Jun 2014 17:25:18 +0000 (11:25 -0600)]
constify probe.c function
This constifies an argument to info_probes_for_ops.
2014-06-18 Tom Tromey <tromey@redhat.com>
* probe.c (info_probes_for_ops): Make "arg" const.
* probe.h (info_probes_for_ops): Update.
Tom Tromey [Tue, 12 Mar 2013 15:51:37 +0000 (09:51 -0600)]
constify struct block in some places
This makes some spots in gdb, particularly general_symbol_info, use a
"const struct block", then fixes the fallout.
The justification is that, ordinarily, blocks ought to be readonly.
Note though that we can't add "const" in the blockvector due to block
relocation. This can be done once blocks are made independent of the
program space.
2014-06-18 Tom Tromey <tromey@redhat.com>
* varobj.c (varobj_create): Update.
* valops.c (value_of_this): Update.
* tracepoint.c (add_local_symbols, scope_info): Update.
* symtab.h (struct general_symbol_info) <block>: Now const.
* symtab.c (skip_prologue_sal)
(default_make_symbol_completion_list_break_on)
(skip_prologue_using_sal): Update.
* stack.h (iterate_over_block_locals)
(iterate_over_block_local_vars): Update.
* stack.c (print_frame_args): Update.
(iterate_over_block_locals, iterate_over_block_local_vars): Make
parameter const.
(get_selected_block): Make return type const.
* python/py-frame.c (frapy_block): Update.
* python/py-block.c (gdbpy_block_for_pc): Update.
* p-exp.y (%union) <bval>: Now const.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* mdebugread.c (mylookup_symbol, parse_procedure): Update.
* m2-exp.y (%union) <bval>: Now const.
* linespec.c (get_current_search_block): Make return type const.
(create_sals_line_offset, find_label_symbols): Update.
* inline-frame.c (inline_frame_sniffer, skip_inline_frames):
Update.
(block_starting_point_at): Make "block" const.
* infrun.c (insert_exception_resume_breakpoint): Make "b" const.
(check_exception_resume): Update.
* guile/scm-frame.c (gdbscm_frame_block): Update.
* guile/scm-block.c (gdbscm_lookup_block): Update.
* frame.h (get_frame_block): Update.
(get_selected_block): Make return type const.
* frame.c (frame_id_inner): Update.
* f-valprint.c (info_common_command_for_block)
(info_common_command): Update.
* dwarf2loc.c (dwarf2_find_location_expression)
(dwarf_expr_frame_base, dwarf2_compile_expr_to_ax)
(locexpr_describe_location_piece): Update.
* c-exp.y (%union) <bval>: Now const.
* breakpoint.c (resolve_sal_pc): Update.
* blockframe.c (get_frame_block):Make return type const.
(get_pc_function_start, get_frame_function, find_pc_sect_function)
(block_innermost_frame): Update.
* block.h (blockvector_for_pc, blockvector_for_pc_sect)
(block_for_pc, block_for_pc_sect): Update.
* block.c (blockvector_for_pc_sect, blockvector_for_pc): Make
'pblock' const.
(block_for_pc_sect, block_for_pc): Make return type const.
* ax-gdb.c (gen_expr): Update.
* alpha-mdebug-tdep.c (find_proc_desc): Update.
* ada-lang.c (ada_read_renaming_var_value): Make 'block' const.
(ada_make_symbol_completion_list, ada_add_exceptions_from_frame)
(ada_read_var_value): Update.
* ada-exp.y (struct name_info) <block>: Now const.
(%union): Likewise.
(block_lookup): Constify.
Siva Chandra [Thu, 5 Jun 2014 14:03:56 +0000 (07:03 -0700)]
Make xmethods tests not to depend on inferior IO.
gdb/testsuite/
PR gdb/17017
* gdb.python/py-xmethods.cc: Add global function call counters and
increment them in their respective functions. Remove "cout"
statements.
* gdb.python/py-xmethods.exp: Make tests check the global function
call counters instead of depending on inferior IO.
Gary Benson [Mon, 16 Jun 2014 14:19:21 +0000 (15:19 +0100)]
Move macros from i386-{nat,low}.c to i386-{nat,low}.h
This commit moves macros required by the soon-to-be-created
nat/i386-dregs.c into i386-{nat,low}.h.
Gary Benson [Mon, 16 Jun 2014 11:18:41 +0000 (12:18 +0100)]
Create nat/i386-dregs.h
This commit moves code to be shared from i386-{nat,low}.[ch]
into a new file, nat/i386-dregs.h.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* nat/i386-dregs.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add the above.
* i386-nat.h (i386-dregs.h): New include.
(DR_FIRSTADDR): Now in i386-dregs.h.
(DR_LASTADDR): Likewise.
(DR_NADDR): Likewise.
(DR_STATUS): Likewise.
(DR_CONTROL): Likewise.
(i386_debug_reg_state): Likewise.
* i386-nat.c (ALL_DEBUG_REGISTERS): Likewise.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.h (i386-dregs.h): New include.
(DR_FIRSTADDR): Now in i386-dregs.h.
(DR_LASTADDR): Likewise.
(DR_NADDR): Likewise.
(DR_STATUS): Likewise.
(DR_CONTROL): Likewise.
(i386_debug_reg_state): Likewise.
(i386_dr_insert_watchpoint): Likewise.
(i386_dr_remove_watchpoint): Likewise.
(i386_dr_region_ok_for_watchpoint): Likewise.
(i386_dr_stopped_data_address): Likewise.
(i386_dr_stopped_by_watchpoint): Likewise.
* i386-low.c (ALL_DEBUG_REGISTERS): Likewise.
Luis Machado [Wed, 18 Jun 2014 09:25:47 +0000 (10:25 +0100)]
Symptom:
Using the test program gdb.base/foll-fork.c, with follow-fork-mode set to
"child" and detach-on-fork set to "off", stepping or running past the fork
call results in the child process running to completion, when it should
just finish the single step. In addition, the breakpoint is not removed
from the parent process, so if it is resumed it receives a SIGTRAP.
Cause:
No matter what the setting for detach-on-fork, when stepping past a fork,
the single-step breakpoint (step_resume_breakpoint) is not handled
correctly in the parent. The SR breakpoint is cloned for the child
process, but before the clone is associated with the child it is treated as
a duplicate of the original, associated wth the parent. This results in
the insertion state of the original SR breakpoint and the clone being
"swapped" by breakpoint.c:update_global_location_list, so that the clone is
marked as inserted.
In the case where the parent is not detached, the two breakpoints remain in
that state. The breakpoint is never inserted in the child, because
although the cloned SR breakpoint is associated with the child, it is
marked as inserted. When the child is resumed, it runs to completion. The
breakpoint is never removed from the parent, so that if it is resumed after
the child exits, it gets a SIGTRAP.
Here is the sequence of events:
1) handle_inferior_event: FORK event is recognized.
2) handle_inferior_event: detach_breakpoints removes all breakpoints
from the child.
3) follow_fork: the parent SR breakpoint is cloned. Part of this procedure
is to call update_global_location_list, which swaps the insertion state of
the original and cloned SR breakpoints as part of ensuring that duplicate
breakpoints are only inserted once. At this point the original SR
breakpoint is not marked as inserted, and the clone is. The breakpoint is
actually inserted in the parent but not the child.
4) follow_fork: the original breakpoint is deleted by calling
delete_step_resume_breakpoint. Since the original is not marked as
inserted, the actual breakpoint remains in the parent process.
update_global_location_list is called again as part of the deletion. The
clone is still associated with the parent, but since it is marked as
enabled and inserted, the breakpoint is left in the parent.
5) follow_fork: if detach-on-fork is 'on', the actual breakpoint will be
removed from the parent in target_detach, based on the cloned breakpoint
still associated with the parent. Then the clone is no longer marked as
inserted. In follow_inferior_reset_breakpoints the clone is associated
with the child, and can be inserted.
If detach-on-fork is 'off', the actual breakpoint in the parent is never
removed (although the breakpoint had been deleted from the list). Since
the clone continues to be marked 'inserted', the SR breakpoint is never
inserted in the child.
Fix:
Set the cloned breakpoint as disabled from the moment it is created. This
is done by modifying clone_momentary_breakpoint to take an additional
argument, LOC_ENABLED, which is used as the value of the
bp_location->enabled member. The clone must be disabled at that point
because clone_momentary_breakpoint calls update_global_location_list, which
will swap treat the clone as a duplicate of the original breakpoint if it
is enabled.
All the calls to clone_momentary_breakpoint had to be modified to pass '1'
or '0'. I looked at implementing an enum for the enabled member, but
concluded that readability would suffer because there are so many places it
is used as a boolean, e.g. "if (bl->enabled)".
In follow_inferior_reset_breakpoints the clone is set to enabled once it
has been associated with the child process. With this, the bp_location
'inserted' member is maintained correctly throughout the follow-fork
procedure and the behavior is as expected.
The same treatment is given to the exception_resume_breakpoint when
following a fork.
Testing:
Ran 'make check' on Linux x64.
Along with the fix above, the coverage of the follow-fork test
gdb.base/foll-fork.exp was expanded to:
1) cover all the combinations of values for
follow-fork-mode and detach-on-fork
2) make sure that both user breakpoints and
single-step breakpoints are propagated
correctly to the child
3) check that the inferior list has the
expected contents after following the fork.
4) check that unfollowed, undetached inferiors
can be resumed.
gdb/
2014-06-18 Don Breazeal <donb@codesourcery.com>
* breakpoint.c (set_longjmp_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
(set_longjmp_breakpoint_for_call_dummy): Call
momentary_breakpoint_from_master with additional argument.
(set_std_terminate_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
(momentary_breakpoint_from_master): Add argument to function
definition and use it to initialize structure member flag.
(clone_momentary_breakpoint): Call
momentary_breakpoint_from_master with additional argument.
* infrun.c (follow_inferior_reset_breakpoints): Clear structure
member flags set in momentary_breakpoint_from_master.
gdb/testsuite/
2014-06-18 Don Breazeal <donb@codesourcery.com>
* gdb.base/foll-fork.exp (default_fork_parent_follow):
Deleted procedure.
(explicit_fork_parent_follow): Deleted procedure.
(explicit_fork_child_follow): Deleted procedure.
(test_follow_fork): New procedure.
(do_fork_tests): Replace calls to deleted procedures with
calls to test_follow_fork and reset GDB for subsequent
procedure calls.
Gary Benson [Mon, 16 Jun 2014 10:06:43 +0000 (11:06 +0100)]
Rename functions and make nonstatic as necessary
This commit renames the functions that are to be shared.
Functions to be shared that were static are made nonstatic.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_show_dr): Renamed to
i386_dr_show and made nonstatic. All uses updated.
(i386_length_and_rw_bits): Renamed to
i386_dr_length_and_rw_bits and made nonstatic.
All uses updated.
(i386_insert_aligned_watchpoint): Renamed to
i386_dr_insert_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_remove_aligned_watchpoint): Renamed to
i386_dr_remove_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_update_inferior_debug_regs): Renamed to
i386_dr_update_inferior_debug_regs and made nonstatic.
All uses updated.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.h (i386_low_insert_watchpoint): Renamed to
i386_dr_insert_watchpoint.
(i386_low_remove_watchpoint): Renamed to
i386_dr_remove_watchpoint.
(i386_low_region_ok_for_watchpoint): Renamed to
i386_dr_region_ok_for_watchpoint.
(i386_low_stopped_data_address): Renamed to
i386_dr_stopped_data_address.
(i386_low_stopped_by_watchpoint): Renamed to
i386_dr_stopped_by_watchpoint.
* i386-low.c (i386_show_dr): Renamed to
i386_dr_show and made nonstatic. All uses updated.
(i386_length_and_rw_bits): Renamed to
i386_dr_length_and_rw_bits and made nonstatic.
All uses updated.
(i386_insert_aligned_watchpoint): Renamed to
i386_dr_insert_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_remove_aligned_watchpoint): Renamed to
i386_dr_remove_aligned_watchpoint and made nonstatic.
All uses updated.
(i386_update_inferior_debug_regs): Renamed to
i386_dr_update_inferior_debug_regs and made nonstatic.
All uses updated.
(i386_low_insert_watchpoint): Renamed to
i386_dr_insert_watchpoint. All uses updated.
(i386_low_remove_watchpoint): Renamed to
i386_dr_remove_watchpoint. All uses updated.
(i386_low_region_ok_for_watchpoint): Renamed to
i386_dr_region_ok_for_watchpoint. All uses updated.
(i386_low_stopped_data_address): Renamed to
i386_dr_stopped_data_address. All uses updated.
(i386_low_stopped_by_watchpoint): Renamed to
i386_dr_stopped_by_watchpoint. All uses updated.
Gary Benson [Mon, 16 Jun 2014 14:06:09 +0000 (15:06 +0100)]
Abstract i386_dr_low access
This commit adds macros to abstract access to the i386_dr_low
function vector used by i386-nat.c. The macros are named so
as to match the names of the functions that do the same work
in gdbserver.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_dr_low_can_set_addr): New macro.
(i386_dr_low_can_set_control): Likewise.
(i386_dr_low_set_addr): Likewise.
(i386_dr_low_set_control): Likewise.
(i386_dr_low_get_addr): Likewise.
(i386_dr_low_get_status): Likewise.
(i386_dr_low_get_control): Likewise.
(i386_insert_aligned_watchpoint): Use new macros.
(i386_update_inferior_debug_regs): Likewise.
(i386_stopped_data_address): Likewise.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.c (i386_dr_low_can_set_addr): New macro.
(i386_dr_low_can_set_control): Likewise.
(i386_insert_aligned_watchpoint): New check.
Gary Benson [Thu, 12 Jun 2014 11:01:11 +0000 (12:01 +0100)]
Merge i386_update_inferior_debug_regs
This commit synchronizes the i386_update_inferior_debug_regs functions
in i386-nat.c and i386-low.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_update_inferior_debug_regs) <state>:
New parameter. All uses updated.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.c (i386_update_inferior_debug_regs) <inf_state>:
Renamed to state.
Gary Benson [Wed, 11 Jun 2014 14:30:50 +0000 (15:30 +0100)]
Rename maint_show_dr to debug_hw_points
This commit renames maint_show_dr to debug_hw_points in i386-nat.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (maint_show_dr): Renamed to debug_hw_points.
All uses updated.
Gary Benson [Wed, 11 Jun 2014 14:42:34 +0000 (15:42 +0100)]
Merge error handling
This commit makes all error handling in i386-low.c use internal_error
rather than fatal and error.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.c (i386_length_and_rw_bits): Use internal_error
instead of fatal and error.
(i386_handle_nonaligned_watchpoint): Likewise.
Gary Benson [Tue, 17 Jun 2014 10:32:58 +0000 (11:32 +0100)]
Merge printing code
This commit synchronizes the debug printing code in i386-nat.c and
i386-low.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (debug_printf): New macro.
(i386_get_debug_register_length): Likewise.
(TARGET_HAS_DR_LEN_8): Use above macro.
(i386_show_dr): Use debug_printf instead of puts_unfiltered
and printf_unfiltered. Use phex to format values.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.c (i386_get_debug_register_length): New macro.
(TARGET_HAS_DR_LEN_8): Remove conditional. Use above macro.
(i386_show_dr): Use debug_printf instead of fprintf. Use
phex to format values.
Gary Benson [Tue, 10 Jun 2014 09:44:00 +0000 (10:44 +0100)]
Add a const
This commit adds a const that was in i386-low.c but not in i386-nat.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_handle_nonaligned_watchpoint) <size_try_array>:
Make const.
Gary Benson [Tue, 17 Jun 2014 10:32:26 +0000 (11:32 +0100)]
Comment changes
This commit fixes various comment differences between
i386-nat.[ch] and i386-low.[ch].
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c: Comment changes.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.h: Comment changes.
* i386-low.c: Likewise.
Gary Benson [Mon, 16 Jun 2014 09:47:02 +0000 (10:47 +0100)]
Remove unused macro
This commit removes an unused macro from i386-nat.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (I386_DR_WATCH_MASK): Remove macro.
Gary Benson [Thu, 12 Jun 2014 13:15:58 +0000 (14:15 +0100)]
Remove unnecessary prototypes
This commit removes four unnecessary prototypes from i386-nat.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c (i386_length_and_rw_bits): Remove prototype.
(i386_insert_aligned_watchpoint): Likewise.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Likewise.
Gary Benson [Tue, 17 Jun 2014 12:11:56 +0000 (13:11 +0100)]
Whitespace changes
This commit fixes various whitespace differences between i386-nat.c
and i386-low.c.
gdb/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-nat.c: Whitespace changes.
gdb/gdbserver/
2014-06-18 Gary Benson <gbenson@redhat.com>
* i386-low.c: Whitespace changes.
Samuel Bronson [Wed, 18 Jun 2014 04:26:46 +0000 (00:26 -0400)]
Brown paper bag: left out part of the ChangeLog entry ...
Samuel Bronson [Wed, 18 Jun 2014 04:12:57 +0000 (00:12 -0400)]
* MAINTAINERS: Update Roland McGrath's email address.
Thanks to Sergio Durigan Junior for pointing out that he left
Red Hat a while ago, and giving me a current address.
Alan Modra [Wed, 18 Jun 2014 00:23:09 +0000 (09:53 +0930)]
daily update
Hans-Peter Nilsson [Tue, 17 Jun 2014 22:11:01 +0000 (00:11 +0200)]
GAS: Fix MMIX err-fb-2.s regression caused by recent generic GAS changes.
Tom Tromey [Tue, 17 Jun 2014 18:57:06 +0000 (12:57 -0600)]
remove redundant savestring declaration
I happened to notice that savestring is still declared in utils.h,
despite the fact that it was moved to common/ a while back. This
patch removes the redundant declaration. Tested by rebuilding. I'm
committing this as obvious.
2014-06-17 Tom Tromey <tromey@redhat.com>
* utils.h (savestring): Remove declaration.
Tom Tromey [Tue, 17 Jun 2014 17:43:21 +0000 (11:43 -0600)]
use make_cleanup_freeargv
This replaces a function cast with a call to make_cleanup_freeargv.
I'm checking this in as obvious.
2014-06-17 Tom Tromey <tromey@redhat.com>
* remote.c (extended_remote_run): Use make_cleanup_freeargv.
Chris Metcalf [Tue, 17 Jun 2014 16:21:08 +0000 (17:21 +0100)]
This fixes a bug whereby #line directives inside a macro would be ignored,
thus resulting in bad line debug information.
PR gas/16908
* macro.c (buffer_and_nest): Honour #line directives inside
macros.
Nick Clifton [Tue, 17 Jun 2014 15:50:15 +0000 (16:50 +0100)]
Prevent large (or negative) version values from overflowing into other fields when
parsing version strings.
PR binutils/16923
* rcparse.y (fixedverinfo): Prevent large version numbers from
corrupting other values.
Yao Qi [Tue, 27 May 2014 11:56:21 +0000 (19:56 +0800)]
Different outputs affected by hosts
We find the following fails in gdb test on mingw host.
FAIL: gdb.base/wchar.exp: print repeat
FAIL: gdb.base/wchar.exp: print repeat_p
FAIL: gdb.base/wchar.exp: print repeat (print null on)
FAIL: gdb.base/wchar.exp: print repeat (print elements 3)
FAIL: gdb.base/wchar.exp: print repeat_p (print elements 3)
print repeat^M
$7 = L"A", '¢' <repeats 21 times>, "B", '\000' <repeats 104 times>^M
(gdb) FAIL: gdb.base/wchar.exp: print repeat
the \242 is expected in the test but cent sign is displayed.
In valprint.c:print_wchar, wchar_printable is called to determine
whether a wchar is printable. wchar_printable calls iswprint but
the iswprint's return value depends on LC_CTYPE setting of locale [1, 2].
The output may vary with different locale settings and OS. IMO, '¢'
(cent sign) is a correct output on Windows.
[1] http://pubs.opengroup.org/onlinepubs/
009604499/functions/iswprint.html
[2] http://msdn.microsoft.com/en-us/library/ewx8s4kw.aspx
This patch is set $cent to cent sign if the GDB is running on a
Windows host.
gdb/testsuite:
2014-06-17 Yao Qi <yao@codesourcery.com>
* gdb.base/wchar.exp: Set $cent to \u00A2 if "host-charset" is
CP1252.
Luis Machado [Tue, 17 Jun 2014 09:42:23 +0000 (10:42 +0100)]
In a couple functions (type_update_when_use_rtti_test and
skip_type_update_when_not_use_rtti_test) the testcase assumes an
uninitialized object has a specific type. In particular, 'ptr' and
's'.
In reality the compiler is free to do what it wants with that
uninitialized variable, even initialize it beforehand with the future
assignment's value. This is exactly what happens on some targets.
ptr should have type 'Base *', but it really has type 'Derived *'
because it is already initialized (earlier) by the compiler. The same
thing happens to 's'.
The following patch addresses this by explicitly initializing those
variables so the compiler doesn't optimize their assignments and GDB
can print their correct values.
2014-06-17 Luis Machado <lgustavo@codesourcery.com>
* gdb.mi/mi-var-rtti.cc (type_update_when_use_rtti_test):
Initialize ptr and S explicitly.
(skip_type_update_when_not_use_rtti_test): Likewise.
Jiong Wang [Tue, 17 Jun 2014 09:06:00 +0000 (10:06 +0100)]
gas/ARM: Misses deprecated IT instruction warning for ARMv8
Add sp increment and decrement to ARMv8 IT block deprecate
pattern.
gas/
* config/tc-arm.c (depr_it_insns): New check for inc/dec sp.
gas/testsuite/
* gas/arm/armv8-a-it-bad.s: New check for inc/dec sp.
* gas/arm/armv8-a-it-bad.l: Likewise.
Alan Modra [Tue, 17 Jun 2014 00:01:07 +0000 (09:31 +0930)]
daily update
Hans-Peter Nilsson [Mon, 16 Jun 2014 22:56:01 +0000 (00:56 +0200)]
GAS: Fix CRIS double-error reports caused by recent generic GAS changes.
Keith Seitz [Wed, 11 Jun 2014 20:26:50 +0000 (13:26 -0700)]
Fix for PR mi/15863
If an MI client creates a varobj and attempts to update the root
/before/ the inferior is started, gdb will throw an internal error:
(gdb)
-var-create * - batch_flag
^done,name="var1",numchild="0",value="0",type="int",has_more="0"
(gdb)
-var-update var1
^done,changelist=[]
(gdb)
-var-update *
~"../../src/gdb/thread.c:628: internal-error: is_thread_state: Assertion `tp' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugging session? "
~"(y or n) "
The function that handles the varobj update in the failing case,
mi_cmd_var_udpate_iter, checks if the thread/inferior is stopped before
attempting to update the varobj. It calls is_stopped (inferior_ptid)
which calls is_thread_state:
tp = find_thread_ptid (ptid);
gdb_assert (tp);
When there is no inferior, ptid is null_ptid, and find_thread_ptid (null_ptid)
returns NULL and the assertion is triggered.
This patch changes mi_cmd_var_update_iter to behave the same way
"-var-update var1" does: by calling the thread "stopped" if
there is no inferior (and thereby calling varobj_update_one).
ChangeLog
2014-06-16 Keith Seitz <keiths@redhat.com>
PR mi/15863
* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Do not attempt
to update the varobj if inferior_ptid is null_ptid.
testsuite/ChangeLog
2014-06-16 Keith Seitz <keiths@redhat.com>
PR mi/15863
* gdb.mi/mi-var-cmd.exp: Add test for -var-update before
the inferior is started.
Nick Clifton [Mon, 16 Jun 2014 16:37:46 +0000 (17:37 +0100)]
Fixes a problem exposed by the aarcg64/illegal.s test case - where the assembler was
generating too many error messages.
* config/tc-aarch64.c (md_apply_fix): Ignore unused relocs.
Tom Tromey [Fri, 6 Jun 2014 19:38:16 +0000 (13:38 -0600)]
constify to_info_proc and friends
This makes a parameter of to_info_proc const and then fixes up some
fallout, including parameters in a couple of gdbarch methods.
I could not test the procfs.c change. I verified it by inspection.
If this causes an error here, it will be trivial to fix.
2014-06-16 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_info_proc>: Make parameter
const.
(target_info_proc): Update.
* target.c (target_info_proc): Make "args" const.
* procfs.c (procfs_info_proc): Update.
* linux-tdep.c (linux_info_proc): Update.
(linux_core_info_proc_mappings): Make "args" const.
(linux_core_info_proc): Update.
* gdbarch.sh (info_proc, core_info_proc): Make "args" const.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* corelow.c (core_info_proc): Update.
Tom Tromey [Fri, 6 Jun 2014 19:26:53 +0000 (13:26 -0600)]
constify to_disconnect
This constifies an parameter of to_disconnect and updates
target_disconnect as well.
2014-06-16 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_disconnect>: Make parameter
const.
(target_disconnect): Update.
* target.c (target_disconnect): Make "args" const.
* target-delegates.c: Rebuild.
* remote.c (remote_disconnect): Update.
* record.h (record_disconnect): Update.
* record.c (record_disconnect): Update.
* inf-child.c (inf_child_disconnect): Update.
Tom Tromey [Fri, 6 Jun 2014 19:19:53 +0000 (13:19 -0600)]
constify to_rcmd
This makes the "command" parameter of the to_rcmd target method const.
2014-06-16 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_rcmd>: Make "command" const.
* target.c (debug_to_rcmd, default_rcmd): Update.
* target-delegates.c: Rebuild.
* remote.c (remote_rcmd): Update.
* monitor.c (monitor_rcmd): Update.
Jiong Wang [Mon, 16 Jun 2014 16:22:19 +0000 (17:22 +0100)]
This fixes the aarch64 assembler so that it will generate error messages when
a syntax error is detected in an optional operand.
* config/tc-aarch64.c (END_OF_INSN): New macro.
(parse_operands): Handle operand given and be in wrong
format when operand is optional.
* gas/aarch64/diagnostic.s: New test patterns.
* gas/aarch64/diagnostic.l: Likewise.
Will Newton [Mon, 16 Jun 2014 14:49:07 +0000 (15:49 +0100)]
ld/ARM: Fix IFUNC and TLS descriptors in the same shared object
Combining TLS descriptors and GNU indirect functions in the same
object could lead to assertions or multiple dynamic relocations
for the same GOT slot. Fix the bookkeeping so this doesn't happen.
This allows building and make checking glibc with -mtls-dialect=gnu2.
bfd/ChangeLog:
2014-06-16 Will Newton <will.newton@linaro.org>
* elf32-arm.c (elf32_arm_allocate_plt_entry): Increment
htab->next_tls_desc_index in the non-IPLT case.
Calculate GOT offset correctly for the non-IPLT case.
(allocate_dynrelocs_for_symbol): Don't increment
htab->next_tls_desc_index here.
ld/testsuite/ChangeLog:
2014-06-16 Will Newton <will.newton@linaro.org>
* ld-arm/arm-elf.exp: Add ifunc-gdesc test.
* ld-arm/ifunc-gdesc.r: New file.
* ld-arm/ifunc-gdesc.s: Likewise.
* ld-arm/ifunc-gdesc.ver: Likewise.
Pedro Alves [Mon, 16 Jun 2014 14:38:13 +0000 (15:38 +0100)]
"$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint.
Turns out there's a difference between loading the program with "gdb
PROGRAM", vs loading it with "(gdb) file PROGRAM". The latter results
in the objfile ending up with OBJF_USERLOADED set, while not with the
former. (That difference seems bogus, but still that's not the point
of this patch. We can revisit that afterwards.)
The new code that suppresses breakpoint removal errors for
add-symbol-file objects ends up being too greedy:
/* In some cases, we might not be able to remove a breakpoint in
a shared library that has already been removed, but we have
not yet processed the shlib unload event. Similarly for an
unloaded add-symbol-file object - the user might not yet have
had the chance to remove-symbol-file it. shlib_disabled will
be set if the library/object has already been removed, but
the breakpoint hasn't been uninserted yet, e.g., after
"nosharedlibrary" or "remove-symbol-file" with breakpoints
always-inserted mode. */
if (val
&& (bl->loc_type == bp_loc_software_breakpoint
&& (bl->shlib_disabled
|| solib_name_from_address (bl->pspace, bl->address)
|| userloaded_objfile_contains_address_p (bl->pspace,
bl->address))))
val = 0;
as it turns out that OBJF_USERLOADED can be set for objfiles loaded by
some other means not add-symbol-file. In this case, symbol-file (or
"file", which is really just "exec-file"+"symbol-file").
Recall that add-symbol-file is documented as:
(gdb) help add-symbol-file
Load symbols from FILE, assuming FILE has been dynamically loaded.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And it's the "dynamically loaded" aspect that the breakpoint.c code
cares about. So make add-symbol-file set OBJF_SHARED on its objfiles
too, and tweak the breakpoint.c code to look for OBJF_SHARED instead
of OBJF_USERLOADED.
This restores back the missing breakpoint removal warning when we let
sss-bp-on-user-bp-2.exp run on native GNU/Linux
(https://sourceware.org/ml/gdb-patches/2014-06/msg00335.html):
(gdb) PASS: gdb.base/sss-bp-on-user-bp-2.exp: define stepi_del_break
stepi_del_break
warning: Error removing breakpoint 3
(gdb) FAIL: gdb.base/sss-bp-on-user-bp-2.exp: stepi_del_break
I say "restores" because this was GDB's behavior in 7.7 and earlier.
And, likewise, "file" with no arguments only started turning
breakpoints set in the main executable to "<pending>" with the
remote-symbol-file patch (
63644780). The old behavior is now
restored, and we break-unload-file.exp test now exercizes both "gdb;
file PROGRAM" and "gdb PROGRAM".
gdb/
2014-06-16 Pedro Alves <palves@redhat.com>
* breakpoint.c (insert_bp_location, remove_breakpoint_1): Adjust.
(disable_breakpoints_in_freed_objfile): Skip objfiles that don't
have OBJF_SHARED set.
* objfiles.c (userloaded_objfile_contains_address_p): Rename to...
(shared_objfile_contains_address_p): ... this. Check OBJF_SHARED
instead of OBJF_USERLOADED.
* objfiles.h (OBJF_SHARED): Update comment.
(userloaded_objfile_contains_address_p): Rename to ...
(shared_objfile_contains_address_p): ... this, and update
comments.
* symfile.c (add_symbol_file_command): Also set OBJF_SHARED in the
new objfile.
(remove_symbol_file_command): Skip objfiles that don't have
OBJF_SHARED set.
gdb/testsuite/
2014-06-16 Pedro Alves <palves@redhat.com>
* gdb.base/break-main-file-remove-fail.c: New file.
* gdb.base/break-main-file-remove-fail.exp: New file.
* gdb.base/break-unload-file.exp: Use build_executable instead of
prepare_for_testing.
(test_break): New parameter "initial_load". Handle it.
(top level): Add initial_load cmdline/file axis.
Tom Tromey [Mon, 16 Jun 2014 08:07:50 +0000 (02:07 -0600)]
fix incorrect comments in minsyms.h
minsyms.h incorrectly claims that a couple of functions call
prim_record_minimal_symbol_full with COPY_NAME=0 -- but actually they
pass 1. Passing 1 is the correct behavior, so this patch fixes the
documentation.
I'm checking this in as obvious.
2014-06-16 Tom Tromey <tromey@redhat.com>
* minsyms.h (prim_record_minimal_symbol)
(prim_record_minimal_symbol_and_info): Update comments.
Alan Modra [Mon, 16 Jun 2014 12:51:16 +0000 (22:21 +0930)]
Fix duplicated assignments to __rel_iplt and __rela_iplt symbols
and fix more nds32 dependencies.
* scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from
.rel sections, and __rel_iplt from .rela sections.
* scripttempl/nds32elf.sc: Likewise.
* Makefile.am (ends32*.c): Depend on nds32elf.sc.
* Makefile.in: Regenerate.
Alan Modra [Mon, 16 Jun 2014 01:34:04 +0000 (11:04 +0930)]
Run write_object_file after errors
This is to fix unitialised memory access when printing listings.
Many targets don't initialise parts of insn frags or data frags that
have fixups, relying on md_apply_fix to finalise the frag. Which is
fine normally, but means we need to run write_object_file after
errors, for listings. Otherwise MALLOC_PERTURB_=1 causes errors like:
x86_64-linux +FAIL: i386 mpx-inval-1
x86_64-linux +FAIL: i386 inval-equ-1
x86_64-linux +FAIL: i386 x86-64-mpx-inval-1
Running write_object_file after errors requires some tweaking to the
testsuite, since we then get extra errors reported from md_apply_fix.
gas/
* write.h (subsegs_finish): Delete declaration.
* write.c (subsegs_finish): Make static.
(write_object_file): Call subsegs_finish from here. Don't print
warning and error count here..
* as.c (main): ..do so here instead. Remove dead code for "no
object file generated". Split out count strings to better support
internationalisation. Don't call subsegs_finish. Tidy setting of
"keep_it". Run write_object_file even after errors.
(keep_it): Make static.
* config/obj-elf.c (elf_frob_symbol): Remove assert.
(elf_frob_file_before_adjust): Likewise.
gas/testsuite/
* gas/elf/bad-group.s: Use %function.
* gas/elf/bad-group.err: Expect correct line number. Allow
other errors.
* gas/elf/bad-size.err: Allow other errors. Match expected
error somewhat more rigorously.
* gas/i386/reloc32.l: Allow other errors.
* gas/i386/mpx-inval-1.l: Match applied relocs.
* gas/i386/x86-64-mpx-inval-1.l: Likewise, and nop padding.
* gas/i386/x86-64-mpx-inval-2.l: Match nop padding, and allow
other errors.
* gas/macros/dot.s: Use .balign.
* gas/macros/dot.l: Update alignment output.
* gas/symver/symver6.l: Allow other errors.
Alan Modra [Mon, 16 Jun 2014 00:32:59 +0000 (10:02 +0930)]
Don't leave DLX the_insn uninitialised
In particular the_insn.reloc must be initialised, otherwise the early
exit cases for bad opcodes will result in cascading errors if
write_object_file is called after an error.
* config/tc-dlx.c (machine_ip): Move initialisation of the_insn
earlier.
Alan Modra [Mon, 16 Jun 2014 01:58:26 +0000 (11:28 +0930)]
Report an error on x86 pcrel BFD_RELOC_SIZE64
* config/tc-i386.c (reloc): Don't avoid pcrel check for
BFD_RELOC_SIZE64. Return NO_RELOC on failing pcrel check.
Alan Modra [Mon, 16 Jun 2014 01:26:56 +0000 (10:56 +0930)]
Fix unintitialised TIC6X data
MALLOC_PERTURB_=1 results in the following fails due to uninitialised
exindx data:
FAIL: C6X unwinding directives 1 (little endian)
FAIL: C6X unwinding directives 2 (big endian)
FAIL: C6X unwinding directives 3 (segment change)
FAIL: ld-tic6x/unwind-1
FAIL: ld-tic6x/unwind-2
FAIL: ld-tic6x/unwind-3
FAIL: ld-tic6x/unwind-4
FAIL: ld-tic6x/unwind-6
* config/tc-tic6x.c (s_tic6x_ehtype): Clear after frag_more.
(tic6x_output_exidx_entry): Likewise.
(md_apply_fix): Simplify 1 byte md_number_to_chars.
Alan Modra [Mon, 16 Jun 2014 01:03:26 +0000 (10:33 +0930)]
Fix TIC54X buffer overruns
MALLOC_PERTURB_=1 results in "FAIL: c54x macros".
* config/tc-tic54x.c (tic54x_mlib): Don't write garbage past
end of archive to temp file.
(tic54x_start_line_hook): Start scan for parallel on next line,
not one char into next line (which may overrun the buffer).
Alan Modra [Mon, 16 Jun 2014 00:47:50 +0000 (10:17 +0930)]
Fix uninitialised VAX insn
MALLOC_PERTURB_=1 results in "FAIL: VAX ELF relocations", due to object
file being emitted with uninitialised fields. Since these fields had
RELA relocs the field value won't be used at final link time, so the
problem is only seen in relocatable object files.
This rewrite of md_apply_fix clears all fields with relocs, whereas
before some fields had non-zero values.
gas/
* config/tc-vax.c (md_apply_fix): Rewrite.
(tc_gen_reloc, vax_cons, vax_cons_fix_new): Style: Use NO_RELOC
define rather than the equivalent BFD_RELOC_NONE.
gas/testsuite/
* gas/vax/elf-rel.d: Update.
Alan Modra [Mon, 16 Jun 2014 00:42:12 +0000 (10:12 +0930)]
Fix uninitialised VAX .got and .got.plt section
Cures these failures with MALLOC_PERTURB_=1
FAIL: GOT test (executable)
FAIL: GOT test (shared library)
FAIL: VAX export class call relocation test
FAIL: VAX export class data relocation test
* elf32-vax.c (elf_vax_size_dynamic_sections): Clear linker
created sections.
Alan Modra [Mon, 16 Jun 2014 00:26:29 +0000 (09:56 +0930)]
Fix uninitialised ARM data
MALLOC_PERTURB_=1 results in "FAIL: PIC" on arm-vxworks, due to garbage
in words with got relocs.
* config/tc-arm.c (s_arm_elf_cons): Initialise after frag_more.
(md_apply_fix): Delete now unnecessary zeroing for BFD_RELOC_ARM_GOT*
and BFD_RELOC_ARM_TLS* relocs. Simplify BFD_RELOC_8 case.
Alan Modra [Mon, 16 Jun 2014 00:20:15 +0000 (09:50 +0930)]
Fix uninitialised CRIS insn
gas/
* config/tc-cris.c (md_create_long_jump): Follow "short" jump
with a nop rather than leaving uninitialised.
gas/testsuite/
* gas/cris/rd-bkw4v32.d: Update.
Alan Modra [Mon, 16 Jun 2014 00:00:38 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 15 Jun 2014 00:01:08 +0000 (09:31 +0930)]
daily update
Eli Zaretskii [Sat, 14 Jun 2014 17:54:16 +0000 (20:54 +0300)]
Include --with-guile in 'show configuration's output.
* top.c (print_gdb_configuration) [HAVE_GUILE]: Print --with-guile
or --without-guile, according to how GDB was built.
Alan Modra [Sat, 14 Jun 2014 00:01:18 +0000 (09:31 +0930)]
daily update
Omair Javaid [Fri, 13 Jun 2014 16:07:21 +0000 (17:07 +0100)]
Add support for reading Aarch64 core dumps.
* elfxx-aarch64.c (stdarg.h): Include.
(string.h): Include.
(_bfd_aarch64_elf_grok_prstatus): Updated.
(_bfd_aarch64_elf_grok_psinfo): New function.
(_bfd_aarch64_elf_write_core_note): New function.
* elfxx-aarch64.h (elf_backend_grok_psinfo): Define.
(elf_backend_write_core_note): Define.
Tom Tromey [Thu, 5 Jun 2014 14:25:00 +0000 (08:25 -0600)]
make calls to help_list use enumerator
Currently there are many calls to help_list that pass the constant -1
as the "class" value. However, the parameter is declared as being of
type enum command_class, and uses of the constant violate this
abstraction.
This patch fixes the error everywhere it occurs in the gdb sources.
Tested by rebuilding.
2014-06-13 Tom Tromey <tromey@redhat.com>
* cp-support.c (maint_cplus_command): Pass all_commands, not -1,
to help_list.
* guile/guile.c (info_guile_command): Pass all_commands, not -1,
to help_list.
* tui/tui-win.c (tui_command): Pass all_commands, not -1, to
help_list.
* tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to
help_list.Pass all_commands, not -1, to help_list.
* cli/cli-dump.c (dump_command, append_command)
(srec_dump_command, ihex_dump_command, tekhex_dump_command)
(binary_dump_command, binary_append_command): Pass all_commands,
not -1, to help_list.
* cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not
-1, to help_list.
* valprint.c (set_print, set_print_raw): Pass all_commands, not
-1, to help_list.
* typeprint.c (set_print_type): Pass all_commands, not -1, to
help_list.
* top.c (set_history): Pass all_commands, not -1, to help_list.
* target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass
all_commands, not -1, to help_list.
* symfile.c (overlay_command): Pass all_commands, not -1, to
help_list.
* spu-tdep.c (info_spu_command): Pass all_commands, not -1, to
help_list.
* serial.c (serial_set_cmd): Pass all_commands, not -1, to
help_list.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not
-1, to help_list.
* remote.c (remote_command, set_remote_cmd): Pass all_commands,
not -1, to help_list.
* ravenscar-thread.c (set_ravenscar_command): Pass all_commands,
not -1, to help_list.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_print_command, maintenance_set_cmd): Pass
all_commands, not -1, to help_list.
* macrocmd.c (macro_command): Pass all_commands, not -1, to
help_list.
* language.c (set_check): Pass all_commands, not -1, to help_list.
* infcmd.c (unset_command): Pass all_commands, not -1, to
help_list.
* frame.c (set_backtrace_cmd): Pass all_commands, not -1, to
help_list.
* dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to
help_list.
* dcache.c (set_dcache_command): Pass all_commands, not -1, to
help_list.
* breakpoint.c (save_command): Pass all_commands, not -1, to
help_list.
* ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass
all_commands, not -1, to help_list.
Chen Gang [Fri, 13 Jun 2014 15:07:21 +0000 (16:07 +0100)]
Fix seg-faults when fetching the frags of local symbols.
* config/tc-score7.c: (s7_b32_relax_to_b16): Use symbol_get_frag() to access a symbol's frag.
* config/tc-score.c (s3_relax_branch_inst16): Likewise.
(s3_relax_cmpbranch_inst32): Likewise.
Chen Gang [Fri, 13 Jun 2014 14:52:55 +0000 (15:52 +0100)]
A simple replacement of sprintf (xxx, "%s", xxx) with strcpy.
* config/tc-score7.c: Replace sprintf with strcpy where
appropriate.
Pierre Langlois [Tue, 20 May 2014 14:13:20 +0000 (15:13 +0100)]
Invalidate a register in cache when a remote target failed to write it.
As shown by the bug report, GDB crashes when the remote target was unable to
write to a register (the program counter) with the 'P' packet. This was reported
for AVR but can be reproduced on any architecture with a gdbserver that fails to
handle a 'P' packet.
Issue
=====
This GDB session was done with a custom gdbserver patched to send an error
packet when trying to set the program counter with a 'P' packet:
~~~
(gdb) file Debug/ATMega2560-simple-program.elf
Reading symbols from Debug/ATMega2560-simple-program.elf...done.
(gdb) target remote :51000
Remote debugging using :51000
0x00000000 in __vectors ()
(gdb) load
Loading section .text, size 0x1fc lma 0x0
Start address 0x0, load size 508
Transfer rate: 248 KB/sec, 169 bytes/write.
(gdb) b main
Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39.
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
main () at .././ATMega2560-simple-program.c:42
42 DDRD |= LED0_MASK;// | LED1_MASK;
(gdb) info line 43
Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code.
(gdb) set $pc=0x178
Could not write register "PC2"; remote failure reply 'E00'
(gdb) info registers pc
pc 0x178 0x178 <main+40>
(gdb) s
../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n)
~~~
We can see that even though GDB reports that writing to the register failed, the
register cache was updated:
~~~
(gdb) set $pc=0x178
Could not write register "PC2"; remote failure reply 'E00'
(gdb) info registers pc
pc 0x178 0x178 <main+40>
~~~
The root of the problem is of course in the gdbserver but I thought GDB should
keep a register cache consistent with the hardware even in case of a failure.
Changes
=======
This patch adds routines to add a regcache_invalidate cleanup to the current
chain.
We can then register one before calling target_store_registers. This way if the
target throws an error, the register we wanted to write to will be invalidated
in cache. If target_store_registers succeeds, we can discard the new cleanup.
2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com>
* regcache.c (struct register_to_invalidate): New structure.
(do_register_invalidate, make_cleanup_regcache_invalidate): New
functions.
(regcache_raw_write): Call make_cleanup_regcache_invalidate.
Alan Modra [Fri, 13 Jun 2014 09:41:39 +0000 (19:11 +0930)]
Free linker hash table from bfd_close.
Also tidies numerous error exit paths in various link_hash_table_create
functions that failed to free memory.
include/
* bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field.
bfd/
* archive.c: Include bfdlink.h.
(_bfd_archive_close_and_cleanup): Call linker hash_table_free.
* bfd.c (struct bfd): Add is_linker_output field.
* elf-bfd.h (_bfd_elf_link_hash_table_free): Update prototype.
* linker.c (_bfd_link_hash_table_init): Set up hash_table_free,
link.hash and is_linker_output.
(_bfd_generic_link_hash_table_free): Replace bfd_link_hash_table*
param with bfd*. Assert is_linker_output and link.hash, and
clear them before exit.
* elf-m10300.c (elf32_mn10300_link_hash_table_free): Replace
bfd_link_hash_table* param with bfd*. Hack is_linker_output
and link.hash so we can free two linker hash tables.
(elf32_mn10300_link_hash_table_create): Create static_hash_table
first. Clean up on errors. Set hash_table_free pointer.
* elf32-arm.c (elf32_arm_link_hash_table_free): Replace
bfd_link_hash_table* param with bfd*.
(elf32_arm_link_hash_table_create): Clean up on errors. Set
hash_table_free pointer.
* elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc1x.c,
* elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-xgate.c,
* elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, * elflink.c,
* elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c,
* xcofflink.c: Similarly.
* simple.c (bfd_simple_get_relocated_section_contents): Save and
clear link.next before creating linker hash table. Clean up on
errors, and restore link.next on exit.
* elf32-m68hc1x.h (m68hc11_elf_bfd_link_hash_table_free): Delete.
* elf32-xgate.h (xgate_elf_bfd_link_hash_table_free): Delete.
* elfxx-sparc.h (_bfd_sparc_elf_link_hash_table_free): Delete.
* libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Delete.
* hash.c (bfd_hash_table_init_n): Free table on error.
* libbfd-in.h (_bfd_generic_link_hash_table_free): Update proto.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
Alan Modra [Fri, 13 Jun 2014 09:41:29 +0000 (19:11 +0930)]
Don't call bfd_link_hash_table_free
Freeing the linker hash table is a royal pain. It can't be freed
before the _bfd_write_contents call in bfd_close, because some target
bfd_write_contents functions access the hash table. It can't be freed
after bfd_close either, since bfd_alloc memory holding side data
structures disappears (PR17047). Clearly the only place it can be freed
is actually in bfd_close. This patch doesn't do that, but kills off
the existing means of freeing the hash table via a bfd target xvec call.
bfd/
PR 17047
* targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free.
(struct bfd_target <_bfd_link_hash_table_free>): Delete.
* bfd.c (bfd_link_hash_table_free): Don't define.
* aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c,
* coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c,
* elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c,
* elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c,
* elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c,
* elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c,
* libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c,
* nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c,
* srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c,
* xsym.c: Don't define various link_hash_table_free defines, and
remove from bfd_target vars. Temporarily reference some of the
target link_hash_table_free functions to avoid warnings.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
ld/
PR 17047
* ldlang.c (output_bfd_hash_table_free_fn): Delete.
(open_output): Don't set it..
* ldmain.c (ld_cleanup): ..or call it.
Alan Modra [Fri, 13 Jun 2014 09:41:19 +0000 (19:11 +0930)]
Move link_hash_table_free functions earlier
Move some code around, in preparation for a followup patch.
* elf-m10300.c, * elf32-arm.c, * elf32-avr.c, * elf32-hppa.c,
* elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c,
* elf32-nios2.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c,
* elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c:
Move link_hash_table_free functions before their corresponding
link_hash_table_create functions.
Alan Modra [Fri, 13 Jun 2014 09:40:57 +0000 (19:10 +0930)]
Make bfd.link_next field a union
This field of struct bfd is currently only used to chain together
linker input files. This patch prepares to use the field to stash
the linker hash table, which is always created on the linker output
file.
bfd/
* bfd.c (struct bfd): Replace link_next with a union.
* aoutx.h, * bfd.c, * coff-ppc.c, * coff-rs6000.c, * cofflink.c,
* ecoff.c, * elf-m10300.c, * elf32-arm.c, * elf32-avr.c,
* elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-metag.c,
* elf32-microblaze.c, * elf32-nds32.c, * elf32-nios2.c,
* elf32-or1k.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-s390.c,
* elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c,
* elf32-tic6x.c, * elf32-tilepro.c, * elf32-xstormy16.c,
* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
* elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * linker.c, * pdp11.c, * peXXigen.c, * simple.c,
* sunos.c, * vms-alpha.c, * xcofflink.c: Update for above.
* bfd-in2.h: Regenerate.
include/
* bfdlink.h: Update for bfd.link_next change.
ld/
* emultempl/cr16elf.em, * emultempl/elf32.em, * emultempl/genelf.em,
* emultempl/m68kcoff.em, * emultempl/m68kelf.em,
* emultempl/nds32elf.em, * emultempl/pe.em, * emultempl/pep.em,
* ldlang.c, * ldmain.c, * pe-dll.c: Update for bfd.link_next change.
Alan Modra [Fri, 13 Jun 2014 02:58:18 +0000 (12:28 +0930)]
Add missing ld makefile dependency for nios.
* Makefile.am (ALL_EMULATION_SOURCES): Add enios2elf.c, enios2linux.c.
* Makefile.in: Regenerate.
Alan Modra [Fri, 13 Jun 2014 00:01:18 +0000 (09:31 +0930)]
daily update
Tom Tromey [Mon, 20 Jan 2014 02:34:23 +0000 (19:34 -0700)]
delete gdbserver's freeargv
gdbserver defines freeargv, but it is now trivial to just use the one
in libiberty.
2014-06-12 Tom Tromey <tromey@redhat.com>
* utils.c (freeargv): Remove.
Tom Tromey [Sun, 19 Jan 2014 21:33:37 +0000 (14:33 -0700)]
link gdbserver against libiberty
This builds a libiberty just for gdbserver and arranges for gdbserver
to use it. I've tripped across the lack of libiberty in gdbserver at
least once, and I have seen other threads where it would have been
useful.
2014-06-12 Tom Tromey <tromey@redhat.com>
* debug.c (debug_printf): Remove HAVE_GETTIMEOFDAY checks.
* server.c (monitor_show_help): Remove HAVE_GETTIMEOFDAY check.
(parse_debug_format_options): Likewise.
(gdbserver_usage): Likewise.
* Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables.
(SUBDIRS, REQUIRED_SUBDIRS): Add libiberty.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link
against libiberty.
($(LIBGNU)): Depend on libiberty.
(all-lib): Recurse into all subdirs.
(install-only): Invoke "install" target in subdirs.
(vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove
targets.
* configure: Rebuild.
* configure.ac: Add ACX_CONFIGURE_DIR for libiberty. Don't check
for vasprintf, vsnprintf, or gettimeofday.
* configure.srv: Don't add safe-ctype.o or lbasename.o to
srv_tgtobj.
Tom Tromey [Thu, 12 Jun 2014 18:04:54 +0000 (12:04 -0600)]
don't use directory in test name
I noticed that a few tests in completion.exp put the directory name
into the name of the resulting test. While the directory name is
relative, this still makes for spurious differences depending on
whether the test was run in serial or parallel mode.
This patch fixes the problem. I'm checking it in.
2014-06-12 Tom Tromey <tromey@redhat.com>
* gdb.base/completion.exp: Don't use directory name in test.
Pedro Alves [Thu, 12 Jun 2014 17:47:54 +0000 (18:47 +0100)]
Move ChangeLog entry to proper place.
gdb/
2014-06-09 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): Initialize status with
W_STOPCODE (0) instead of 0. Remove shodowing 'status' local from
inner block. Only pass the signal to PTRACE_DETACH if in pass
state.
Yao Qi [Sat, 23 Nov 2013 08:05:58 +0000 (16:05 +0800)]
Use varobj_is_dynamic_p more widely
Use varobj_is_dynamic_p more widely so that the callers of
varobj_is_dynamic_p are unchanged when we add available-children-only
stuff in varobj_is_dynamic_p.
gdb:
2014-06-12 Yao Qi <yao@codesourcery.com>
* varobj.c (varobj_get_num_children): Call
varobj_is_dynamic_p.
(varobj_list_children): Likewise.
(varobj_update): Likewise. Update comments.
Yao Qi [Sat, 23 Nov 2013 07:58:04 +0000 (15:58 +0800)]
Rename varobj_pretty_printed_p to varobj_is_dynamic_p
We think varobj with --available-children-only behaves like a dynamic
varobj, so dyanmic varobj is not pretty-printer specific. We rename
varobj_pretty_printed_p to varobj_is_dynamic_p, so that we can handle
available-children-only checking in varobj_is_dynamic_p in the next
patch.
gdb:
2014-06-12 Yao Qi <yao@codesourcery.com>
* varobj.c (varobj_pretty_printed_p): Rename to ...
(varobj_is_dynamic_p): ... this. New function.
* varobj.h (varobj_pretty_printed_p): Remove declaration.
(varobj_is_dynamic_p): Declare.
* mi/mi-cmd-var.c (print_varobj): All callers updated.
(mi_print_value_p, varobj_update_one): Likewise.
Yao Qi [Fri, 30 Aug 2013 08:30:32 +0000 (16:30 +0800)]
Remove #if HAVE_PYTHON
This patch removes some unnecessary "#if HAVE_PYTHON" so that more
code is generalized.
gdb:
2014-06-12 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* varobj.c: Remove "#if HAVE_PYTHON" and "#endif".
(varobj_get_iterator): Wrap up code for pretty-printer by
"#if HAVE_PYTHON" and "#endif".
(update_dynamic_varobj_children): Likewise.
Yao Qi [Tue, 12 Nov 2013 12:49:52 +0000 (20:49 +0800)]
Iterate over 'struct varobj_item' instead of PyObject
In previous patch, "saved_item" is still a PyOjbect and iteration is
still performed over PyObject. This patch continues to decouple
iteration from python code, so it changes its type to "struct
varobj_item *", so that the iterator itself is independent of python.
V2:
- Call varobj_delete_iter in free_variable.
- Fix changelog entries.
- Use XNEW.
V3:
- Return NULL early in py_varobj_iter_next if gdb_python_initialized
is false.
gdb:
2014-06-12 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* python/py-varobj.c (py_varobj_iter_next): Return NULL if
gdb_python_initialized is false. Move some code from varobj.c.
* varobj-iter.h (struct varobj_item): Moved from varobj.c.
* varobj.c: Move "varobj-iter.h" inclusion earlier.
(struct varobj_item): Moved to varobj-iter.h".
(varobj_clear_saved_item): New function.
(update_dynamic_varobj_children): Move python-related code to
py-varobj.c.
(free_variable): Call varobj_clear_saved_item and
varobj_iter_delete.
Yao Qi [Fri, 30 Aug 2013 01:44:46 +0000 (09:44 +0800)]
Generalize varobj iterator
This patch generalizes varobj iterator, in a python-independent way.
Note varobj_item is still a typedef of PyObject, we can only focus on
API changes, and leave the data type changes to the next patch. As a
result, we include "varobj-iter.h" after the typedef of PyObject in
varobj.c, but it is an intermediate state. Finally, varobj-iter.h is
independent of PyObject.
This change is helpful to move some python-related code out of
varobj.c.
V2:
- Fix a missing cleanup.
- Fix typos.
- Use XNEW.
- Check against NULL explicitly.
- Update copyright year for new added files.
V3:
- Call PyGILState_Ensure before Py_XDECREF.
- Use CPYCHECKER_STEALS_REFERENCE_TO_ARG.
- Code indentation.
V4:
- use varobj_ensure_python_env instead of PyGILState_Ensure.
gdb:
2014-06-12 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* Makefile.in (SUBDIR_PYTHON_OBS): Add "py-varobj.o".
(SUBDIR_PYTHON_SRCS): Add "python/py-varobj.c".
(HFILES_NO_SRCDIR): Add "varobj-iter.h".
(py-varobj.o): New rule.
* python/py-varobj.c: New file.
* python/python-internal.h (py_varobj_get_iterator): Declare.
* varobj-iter.h: New file.
* varobj.c: Include "varobj-iter.h"
(struct varobj) <child_iter>: Change its type from "PyObject *"
to "struct varobj_iter *".
<saved_item>: Likewise.
[HAVE_PYTHON] (varobj_ensure_python_env): Make it extern.
[HAVE_PYTHON] (varobj_get_iterator): New function.
(update_dynamic_varobj_children) [HAVE_PYTHON]: Move
python-specific code to python/py-varobj.c.
(install_visualizer): Call varobj_iter_delete instead of
Py_XDECREF.
* varobj.h (varobj_ensure_python_env): Declare.
Yao Qi [Tue, 10 Sep 2013 00:58:23 +0000 (08:58 +0800)]
Use 'struct varobj_item' to represent name and value pair
Hi,
name and value pair is widely used in varobj.c. This patch is to add
a new struct varobj_item to represent them, so that the number of
function arguments can be reduced. Finally, the iteration is done on
'struct varobj_item' instead of PyObject after this patch series.
V2:
- Fix changelog entry.
- Fix one grammatical mistake.
gdb:
2014-06-12 Yao Qi <yao@codesourcery.com>
* varobj.c (struct varobj_item): New structure.
(create_child_with_value): Update declaration.
(varobj_add_child): Replace arguments 'name' and 'value' with
'item'. All callers updated.
(install_dynamic_child): Likewise.
(update_dynamic_varobj_children): Likewise.
(varobj_add_child): Likewise.
(create_child_with_value): Likewise.
Alan Modra [Thu, 12 Jun 2014 02:34:06 +0000 (12:04 +0930)]
Whitespace fixes for cpu/or1k.opc
* or1k.opc: Whitespace fixes.
Alan Modra [Thu, 12 Jun 2014 00:00:43 +0000 (09:30 +0930)]
daily update
Joel Brobecker [Wed, 11 Jun 2014 16:52:29 +0000 (18:52 +0200)]
Update NEWS post GDB 7.8 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Wed, 11 Jun 2014 16:37:55 +0000 (18:37 +0200)]
Bump version to 7.8.50.DATE-cvs.
Now that the GDB 7.8 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 7.8 branch created (
173373c6f6388171d1d62a217fae90a052395be2):
* version.in: Bump version to 7.8.50.DATE-cvs.
Andrew Burgess [Tue, 27 May 2014 10:57:33 +0000 (11:57 +0100)]
Delete temporary string within demangler even in failure cases.
A call to demangle_template might allocate storage within a temporary
string even if the call to demangle_template eventually returns
failure.
This will never cause the demangler to crash, but does leak memory, as
a result I've not added any tests for this.
Calling string_delete is safe, even if nothing is allocated into the
string, the string is initialised with string_init, so we know the
internal pointers are NULL.
libiberty/ChangeLog
* cplus-dem.c (do_type): Call string_delete even if the call to
demangle_template fails.
Pedro Alves [Wed, 11 Jun 2014 10:04:31 +0000 (11:04 +0100)]
PR remote/17028: GDB+GDBserver hangs on Windows
Since target-async was turned on by default, debugging on Windows
using GDB+GDBserver sometimes hangs while waiting for a RSP reply.
The problem is a race in the gdb_select machinery.
This is what we see for a faulty next on the GDB side:
(gdb) n
infrun: clear_proceed_status_thread (Thread 4424)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
(...)
infrun: resume (step=1, signal=GDB_SIGNAL_0), ...
Sending packet: $vCont;s:1148;c#5e...
*hang*
At this point, attaching a debugger to the hanging GDB confirms that
it is blocked, waiting for a socket event:
#6 0x757841d8 in WaitForMultipleObjects ()
from C:\Windows\syswow64\kernel32.dll
#7 0x004708e7 in gdb_select (n=469, readfds=0x88ca50 <gdb_notifier+784>,
writefds=0x88cb54 <gdb_notifier+1044>,
exceptfds=0x88cc58 <gdb_notifier+1304>, timeout=0x0)
at /[...]/gdb/mingw-hdep.c:172
#8 0x00527926 in gdb_wait_for_event (block=1)
at /[...]/gdb/event-loop.c:831
#9 0x00526ff1 in gdb_do_one_event ()
at /[...]/gdb/event-loop.c:403
However, on the GDBserver side, we see that GDBserver already sent a
T05 packet reply:
gdbserver: kernel event EXCEPTION_DEBUG_EVENT for pid=4968 tid=1148
EXCEPTION_SINGLE_STEP
Child Stopped with signal = 5
Writing resume reply for LWP 4968.4424:1
DEBUG: write_prim ($T0505:
c8fe2800;04:
a0fe2800;08:
38164000;thread:1148;#f0)
-> 55
To recap, on Windows, 'select' only works with sockets, so we have a
wrapper, gdb_select, that uses the GDB serial abstraction to handle
sockets, consoles, pipes, and serial ports. Each serial descriptor
has a thread associated (we call those the select threads), and those
threads communicate with the main thread by means of standard Windows
events.
It basically goes like this: gdb_select first loops through all fds of
interest, calling their wait_handle hooks, which returns an event that
WaitForMultipleObjects can wait on. gdb_select then blocks in
WaitForMultipleObjects with all those event handles. The wait_handle
hook is responsible for arranging for the returned event to become set
once data is available. This is done by setting the descriptor's
helper thread running, which itself knows how to wait for data from
the type of handle it manages (sockets, pipes, consoles, files, etc.).
Once data arrives, the select thread sets the corresponding event
which unblocks WaitForMultipleObjects within gdb_select. However, the
wait_handle hook can also apply an optimization: if data is already
pending, then there's no need to set the thread running, and the
descriptors event can be set immediately. It's around this latter
aspect that lies the bug/race.
Adding some ad hoc debug logs to ser-mingw.c and mingw-hdep.c, we see
the following sequence of events, right after sending
"$vCont;s:1148;c#5e". Thread 1 is the main thread, and thread 2 is
the socket's helper/select thread. gdb_select was only passed one
descriptor to wait on, the remote target's socket.
net_windows_select_thread is the entry point of the select threads for
sockets.
#1 - thread 1: gdb_select: enter
#2 - thread 2: net_windows_select_thread: WaitForMultipleObjects blocking
gdb_select walked over the wait_handle hooks, and woke up the socket's
helper thread. The helper thread is now blocked waiting for socket
events.
#3 - thread 1: gdb_select: WaitForMultipleObjects polling (timeout=0ms)
#4 - thread 1: gdb_select: WaitForMultipleObjects returned 102 (WAIT_TIMEOUT)
There was no pending data available yet, and gdb_select was passed
timeout==0ms, and so WaitForMultipleObjects times out immediately.
#5 - thread 2: net_windows_select_thread: WaitForMultipleObjects returned 1
Just afterwards, socket data arrives, and thread 2 wakes up. Thread 2
calls WSAEnumNetworkEvents, which clears state->sock_event, and marks
the serial's read_event event, telling the main thread that data is
available.
#6 - thread 1: gdb_select: call serial_done_wait_handle on each serial
gdb_select stops all the helper/select threads.
#7 - thread 1: gdb_select: return 0 (WAIT_TIMEOUT)
gdb_select in the main thread returns to the caller.
Note that at this point, data is pending on the socket, the serial's
read_event is set, but the socket's sock_event event is not set, until
_further_ data arrives.
Now GDB does its thing and goes back to the event loop. That calls
gdb_select, but with timeout==INFINITE.
Again, gdb_select calls the socket serial's wait_handle hook. It
first clears its events, starting from a clean slate:
ResetEvent (state->base.read_event);
ResetEvent (state->base.except_event);
ResetEvent (state->base.stop_select);
That cleared read_event, which was previously set in #5 above. And
then it checks for pending events, in the sock_event event:
/* Check any pending events. This both avoids starting the thread
unnecessarily, and handles stray FD_READ events (see below). */
if (WaitForSingleObject (state->sock_event, 0) == WAIT_OBJECT_0)
{
That also fails because state->sock_event was cleared in #5 too...
So the wait_handle hook erroneously decides that it needs to start the
helper thread to wait for input:
#8 - thread 2: net_windows_select_thread: WaitForMultipleObjects blocking
#9 - thread 1: gdb_select: WaitForMultipleObjects blocking (INFINITE)
But, GDBserver already sent all it had to send, so both threads waits
forever...
At first I thought that net_windows_wait_handle shouldn't be resetting
state->base.read_event or state->base.except_event, but looking
deeper, the pipe and console wait_handle hooks reset all events too.
It actually makes sense that way -- consuming an event from different
threads is bad practice, and, we should always be able to query
pending state without looking at the state->sock_event from within
net_windows_wait_handle. The end result is much simpler, and makes
net_windows_select_thread look a lot like console_select_thread,
actually.
gdb/
2014-06-11 Pedro Alves <palves@redhat.com>
PR remote/17028
* ser-mingw.c (net_windows_socket_check_pending): New function.
(net_windows_select_thread): Ignore spurious wakeups. Use
net_windows_socket_check_pending.
(net_windows_wait_handle): Check for pending events with
ioctlsocket, through net_windows_socket_check_pending, instead of
checking the socket's event.
Alan Modra [Wed, 11 Jun 2014 09:41:12 +0000 (19:11 +0930)]
Fix silly thinko
* linker.c (unwrap_hash_lookup): Add missing parens.