aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-06-20Move shared native target specific code to gdb/natGary Benson38-74/+117
https://sourceware.org/gdb/wiki/Common describes the following directory structure: gdb/nat/ Native target backend files. Code that interfaces with the host debug API. E.g., ptrace code, Windows debug API code, procfs code should go here. gdb/target/ Host-independent, target vector specific code (target_ops). gdb/common/ All other shared code. This commit moves all native target backend files currently in gdb/common to gdb/nat. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * common/gdb_thread_db.h: Moved to nat. All includes updated. * common/glibc_thread_db.h: Likewise. * common/i386-cpuid.h: Likewise. * common/i386-gcc-cpuid.h: Likewise. * common/linux-btrace.h: Likewise. * common/linux-osdata.h: Likewise. * common/linux-procfs.h: Likewise. * common/linux-ptrace.h: Likewise. * common/mips-linux-watch.h: Likewise. * common/linux-btrace.c: Moved to nat. * common/linux-osdata.c: Likewise. * common/linux-procfs.c: Likewise. * common/linux-ptrace.c: Likewise. * common/mips-linux-watch.c: Likewise. * nat/gdb_thread_db.h: Moved from common. * nat/glibc_thread_db.h: Likewise. * nat/i386-cpuid.h: Likewise. * nat/i386-gcc-cpuid.h: Likewise. * nat/linux-btrace.c: Likewise. * nat/linux-btrace.h: Likewise. * nat/linux-osdata.c: Likewise. * nat/linux-osdata.h: Likewise. * nat/linux-procfs.c: Likewise. * nat/linux-procfs.h: Likewise. * nat/linux-ptrace.c: Likewise. * nat/linux-ptrace.h: Likewise. * nat/mips-linux-watch.c: Likewise. * nat/mips-linux-watch.h: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Reflect new locations. (object file files): Reordered. * gdb/copyright.py (EXCLUDE_LIST): Reflect new location of glibc_thread_db.h. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * Makefile.in (SFILES): Update locations for files moved from common to nat. (object file files): Reordered. gdb/testsuite/ 2014-06-20 Gary Benson <gbenson@redhat.com> * gdb.arch/i386-avx.exp: Fix include file location. * gdb.arch/i386-sse.exp: Likewise.
2014-06-20Vectorize gdbserver x86 debug register accessorsGary Benson8-128/+154
This commit makes gdbserver access the x86 debug register accessor functions via the same function vector as GDB proper. This removes a chunk of conditional code that was previously in i386-{nat,low}.h and leaves a single macro as the only GDB/gdbserver difference in nat/i386-dregs.c. gdb/ 2014-06-20 Gary Benson <gbenson@redhat.com> * i386-nat.h (debug_hw_points): Moved to nat/i386-dregs.c. (i386_dr_low_type): Moved to nat/i386-dregs.h. (i386_dr_low): Likewise. (i386_dr_low_can_set_addr): Moved to nat/i386-dregs.c. (i386_dr_low_set_addr): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_get_debug_register_length): Likewise. * nat/i386-dregs.h (i386_dr_low_type): Moved from i386-nat.h. (i386_dr_low): Likewise. * nat/i386-dregs.c (i386-low.h): Remove include. (i386-nat.h): Likewise. (nat/i386-dregs.h): New include. (i386_dr_low_can_set_addr): Moved from i386-nat.h. (i386_dr_low_set_addr): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_get_debug_register_length): Likewise. (debug_hw_points): Likewise. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * i386-low.h (i386_dr_low_can_set_addr): Removed. (i386_dr_low_set_addr): Likewise. (i386_dr_low_get_addr): Likewise. (i386_dr_low_can_set_control): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_get_debug_register_length): Likewise. * linux-x86-low.c (i386_dr_low_set_addr): Changed signature. Made static. (i386_dr_low_get_addr): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_dr_low): New global variable. * win32-i386-low.c (i386_dr_low_set_addr): Changed signature. Made static. (i386_dr_low_get_addr): Likewise. (i386_dr_low_set_control): Likewise. (i386_dr_low_get_control): Likewise. (i386_dr_low_get_status): Likewise. (i386_dr_low): New global variable.
2014-06-20Fix gdbserver cross build.Marcus Shawcroft4-0/+102
The recent libiberty patch caused issues when cross building gdbserver. The Makefile ends invoking the build machine's "ar" instead of the --host version: ar ./libiberty.a \ ./regex.o (...) ar: illegal option -- . Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file... ar -M [<mri-script] The libiberty configure script does probe for and finds an appropriate AR. However, gdbserver's configure does not probe for AR and overrides the AR used in the libiberty build by explicitly passing AR to the sub-builds. gdb/gdbserver/ 2014-06-20 Marcus Shawcroft <marcus.shawcroft@arm.com> * configure.ac: Invoke. AC_CHECK_TOOL(AR, ar). * Makefile.in (AR, AR_FLAGS): Define. * configure: Regenerate.
2014-06-20Similarly to the AArch64 patch, set DF_STATIC_TLS for consistency withKyle McMartin2-0/+8
other architectures when we emit IE relocs in a shared library. * elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when emitting initial-exec relocs when not linking an executable.
2014-06-20daily updateAlan Modra1-1/+1
2014-06-19Initial pass at D language expression parser support.Iain Buclaw7-8/+1808
gdb/ 2014-06-05 Iain Buclaw <ibuclaw@gdcproject.org> * Makefile.in (SFILES): Add d-exp.y. (YYFILES): Add d-exp.c. (YYOBJ): Add d-exp.o. (local-maintainer-clean): Delete d-exp.c. * d-exp.y: New file. * d-lang.h (d_parse): New declaration. (d_error): New declaration. * d-lang.c (d_op_print_tab): Add entry for BINOP_CONCAT and BINOP_EXP. Set BINOP_EQUAL and BINOP_NOTEQUAL to same precedence as other PREC_ORDER operators. (d_language_defn): Use d_parse, d_error instead of c_parse, c_error. gdb/testsuite/ 2014-06-05 Iain Buclaw <ibuclaw@gdcproject.org> * gdb.dlang/expression.exp: New file.
2014-06-19Remove any_runningYao Qi3-15/+5
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.
2014-06-19Use enum thread_stateYao Qi2-8/+11
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.
2014-06-19Fix next over threaded execl with "set scheduler-locking step".Pedro Alves9-30/+69
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.
2014-06-19Directly call i386-dregs functionsGary Benson2-6/+21
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.
2014-06-19Create nat/i386-dregs.cGary Benson19-1133/+752
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.
2014-06-19Refactor i386_{insert,remove}_hw_breakpointGary Benson2-34/+11
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.
2014-06-19Partially revert 4be83cc2b28ea09aa8ff789839e6520df60836f8Gary Benson5-112/+107
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.
2014-06-19Demangler crash handlerGary Benson8-3/+214
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.
2014-06-19Refactor and expose core-dumping functionalityGary Benson3-12/+80
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.
2014-06-19Add new internal problem for demangler warningsGary Benson6-46/+134
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.
2014-06-19The testcase was generating DW_AT_high_pc and DW_AT_low_pc entriesLuis Machado2-6/+11
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.
2014-06-19daily updateAlan Modra1-1/+1
2014-06-18[rx] Make .B suffix optional when possible.DJ Delorie2-6/+15
* config/rx-parse.y (BSET, BCLR, BTST, BNOT, BMCMD): Make .B suffix optional.
2014-06-18ld/ARM: Add target arm*b-*-freebsd*, update target arm*-*-freebsd*.Andreas Tobler6-2/+33
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.
2014-06-18make common_block constTom Tromey3-2/+8
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.
2014-06-18constify some blockvector APIsTom Tromey18-52/+89
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.
2014-06-18constify complete_lineTom Tromey3-2/+7
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.
2014-06-18remove unneeded cast in symtab.cTom Tromey2-1/+5
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.
2014-06-18constify parse_cli_boolean_valueTom Tromey3-2/+7
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.
2014-06-18constify probe.c functionTom Tromey3-5/+11
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.
2014-06-18constify struct block in some placesTom Tromey32-75/+133
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.
2014-06-18Make xmethods tests not to depend on inferior IO.Siva Chandra3-25/+70
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.
2014-06-18Move macros from i386-{nat,low}.c to i386-{nat,low}.hGary Benson5-24/+46
This commit moves macros required by the soon-to-be-created nat/i386-dregs.c into i386-{nat,low}.h.
2014-06-18Create nat/i386-dregs.hGary Benson8-100/+173
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.
2014-06-18Symptom:Luis Machado5-72/+182
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.
2014-06-18Rename functions and make nonstatic as necessaryGary Benson7-105/+160
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.
2014-06-18Abstract i386_dr_low accessGary Benson4-6/+44
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.
2014-06-18Merge i386_update_inferior_debug_regsGary Benson4-15/+24
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.
2014-06-18Rename maint_show_dr to debug_hw_pointsGary Benson2-10/+15
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.
2014-06-18Merge error handlingGary Benson2-9/+16
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.
2014-06-18Merge printing codeGary Benson4-47/+73
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.
2014-06-18Add a constGary Benson2-1/+6
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.
2014-06-18Comment changesGary Benson5-34/+56
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.
2014-06-18Remove unused macroGary Benson2-3/+4
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.
2014-06-18Remove unnecessary prototypesGary Benson2-36/+7
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.
2014-06-18Whitespace changesGary Benson4-25/+45
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.
2014-06-18Brown paper bag: left out part of the ChangeLog entry ...Samuel Bronson1-1/+1
2014-06-18* MAINTAINERS: Update Roland McGrath's email address.Samuel Bronson2-1/+7
Thanks to Sergio Durigan Junior for pointing out that he left Red Hat a while ago, and giving me a current address.
2014-06-18daily updateAlan Modra1-1/+1
2014-06-18GAS: Fix MMIX err-fb-2.s regression caused by recent generic GAS changes.Hans-Peter Nilsson2-0/+18
2014-06-17remove redundant savestring declarationTom Tromey2-2/+4
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.
2014-06-17use make_cleanup_freeargvTom Tromey2-1/+5
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.
2014-06-17This fixes a bug whereby #line directives inside a macro would be ignored,Chris Metcalf2-0/+28
thus resulting in bad line debug information. PR gas/16908 * macro.c (buffer_and_nest): Honour #line directives inside macros.
2014-06-17Prevent large (or negative) version values from overflowing into other ↵Nick Clifton2-4/+10
fields when parsing version strings. PR binutils/16923 * rcparse.y (fixedverinfo): Prevent large version numbers from corrupting other values.