aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-09-05daily updateAlan Modra1-1/+1
2014-09-04parse_number("0") reads uninitialized memoryPedro Alves2-1/+6
valgrind caught that parse_number reads uninitialized memory when we parse literal "0": $ valgrind ./gdb -q -nx -ex "set height 0" (...) ==10378== Conditional jump or move depends on uninitialised value(s) ==10378== at 0x548A10: parse_number (c-exp.y:1828) ==10378== by 0x54A340: lex_one_token (c-exp.y:2638) ==10378== by 0x54B4BB: c_lex (c-exp.y:3089) ==10378== by 0x544951: c_parse_internal (c-exp.c:2208) ==10378== by 0x54BF8C: c_parse (c-exp.y:3260) ==10378== by 0x6502E7: parse_exp_in_context_1 (parse.c:1221) ==10378== by 0x650064: parse_exp_in_context (parse.c:1122) ==10378== by 0x65001F: parse_exp_1 (parse.c:1114) ==10378== by 0x650421: parse_expression (parse.c:1266) ==10378== by 0x5A74B7: parse_and_eval_long (eval.c:92) ==10378== by 0x501ABD: do_set_command (cli-setshow.c:302) ==10378== by 0x721059: execute_command (top.c:452) ==10378== (gdb) I've pushed the obvious fix. Tested on x86_64 Fedora 20. gdb/ChangeLog: * c-exp.y (parse_number): Skip handling base-switching prefixes if the input is only one character long.
2014-09-04Fix PR fortran/17237: bug in f-valprint.cSergio Durigan Junior5-1/+72
This commit fixes the PR mentioned in $subject. It is about a set but unused variable that refers to the output format of integer values printed in Fortran. This was probably a thinko (like most set-but-unused-vars), but it could cause an internal error depending on the scenario. I am sending a testcase which triggers this error as well. gdb/ChangeLog: 2014-09-04 Sergio Durigan Junior <sergiodj@redhat.com> PR fortran/17237 * f-valprint.c (f_val_print): Specify the correct print option to use when printing integer values. gdb/testsuite/ChangeLog: 2014-09-04 Sergio Durigan Junior <sergiodj@redhat.com> PR fortran/17237 * gdb.fortran/print-formatted.exp: New file. * gdb.fortran/print-formatted.f90: Likewise.
2014-09-04Remove code to cope with LWPs wrapped as PIDsGary Benson2-4/+8
Historically the Linux x86 watchpoint code did not cope with multi- threaded processes and LWP IDs were passed to it wrapped as PIDs. Not all entry points were converted when the Linux x86 watchpoint code was made multi-thread-aware, so a handler was left in place to cope with wrapped LWPs. Since then all such entry points have been converted to pass regular LWPs and the handler is now redundant. This commit removes the handler and adds assertions to ensure no wrapped LWPs are passed in future. gdb/ChangeLog: * x86-linux-nat.c (x86_linux_dr_get, x86_linux_dr_set): Remove code to cope with LWPs wrapped as PIDs. Add assertions to ensure no wrapped LWPs are passed.
2014-09-04Regression for i686 gdb.dwarf2/pieces-optimized-out.expPedro Alves3-125/+125
Git 9a0dc9e3 regressed gdb.dwarf2/pieces-optimized-out.exp, visible on i686 (the test doesn't run on x86_64): (gdb) p s -$1 = {a = 5, b = <optimized out>, c = <optimized out>, d = <optimized out>} +$1 = {a = 5, b = <optimized out>, c = 0, d = 0} -(gdb) PASS: gdb.dwarf2/pieces-optimized-out.exp: print s +(gdb) FAIL: gdb.dwarf2/pieces-optimized-out.exp: print s The regression was caused by this removal in cp-valprint.c: @@ -293,12 +293,6 @@ cp_print_value_fields (struct type *type, struct type *real_type, { fputs_filtered (_("<synthetic pointer>"), stream); } - else if (!value_bits_valid (val, - TYPE_FIELD_BITPOS (type, i), - TYPE_FIELD_BITSIZE (type, i))) - { - val_print_optimized_out (val, stream); - } else { struct value_print_options opts = *options; The idea was that we'd just fallback to calling value_field_bitfield, which handles unavailable values (in unpack_value_bits_as_long_1) so should be able to handle optimized out values too. Alas, it doesn't. This is currently a bit too messy. Instead of teaching unpack_value_bits_as_long_1 about optimized out bits, let's bite the bullet and teach the value code to handle partially optimized out bitfield, by having it unpack a bitfield and then propagate the range metadata. Turns out the resulting code looks simpler and clearer. Tested on x86_64 Fedora 20, -m64/-m32. gdb/ChangeLog: * value.c (value_ranges_copy_adjusted): New function, factored out from ... (value_contents_copy_raw): ... here. (unpack_value_bits_as_long_1): Rename back to ... (unpack_bits_as_long): ... this. Remove 'original_value' and 'result' parameters. Change return type to LONGEST. (unpack_value_bits_as_long): Delete. (unpack_value_field_as_long_1): Delete. (unpack_value_field_as_long, unpack_field_as_long): Reimplement. (unpack_value_bitfield): New function. (value_field_bitfield): Reimplement using unpack_value_bitfield. (value_fetch_lazy): Use unpack_value_bitfield. * value.h (unpack_value_bits_as_long): Delete declaration.
2014-09-04MIPS: Update the list of addr32 targetsMatthew Fortune2-1/+7
gas/testsuite/ * gas/mips/mips.exp: Add mipsisa32 and mipsisa32el to the list of addr32 targets.
2014-09-04daily updateAlan Modra1-1/+1
2014-09-03Improve Type.template_argument docs in Python API.Justin Lebar2-4/+11
gdb/doc/ChangeLog: * python.texi (Types In Python): Type.template_argument(n) returns a gdb.Value or a gdb.Type and throws an exception if n is out of range.
2014-09-03Add support for reading frame registers to Python API.Sasha Smundak7-0/+77
The ability to read registers is needed to use Frame Filter API to display the frames created by JIT compilers. gdb/ChangeLog: 2014-08-29 Sasha Smundak <asmundak@google.com> * python/py-frame.c (frapy_read_register): New function. gdb/doc/ChangeLog: 2014-08-26 Sasha Smundak <asmundak@google.com> * python.texi (Frames in Python): Add read_register description. gdb/testsuite/ChangeLog: 2014-08-26 Sasha Smundak <asmundak@google.com> * gdb.python/py-frame.exp: Test Frame.read_register.
2014-09-03Reset errno before PTRACE_PEEKUSER for MIPS DSP_CONTROLJames Hogan4-0/+12
PTRACE_PEEKUSER can return -1, which is usually used to determine whether a system call has reported an error, so errno must be used alone to determine whether an error occurred. However errno isn't modified by a successful system call so it must be reset to a known value (0) before the syscall call. Add the missing errno reset when reading the DSP_CONTROL register in the native MIPS Linux backend and the MIPS gdbserver backend. gdb/: * mips-linux-nat.c (mips_linux_read_description): Reset errno to 0 prior to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call. gdb/gdbserver/: * linux-mips-low.c (mips_read_description): Reset errno to 0 prior to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call.
2014-09-03PR python/16699: GDB Python command completion with overriden complete vs. ↵Sergio Durigan Junior10-28/+359
completer class This PR came from a Red Hat bug that was filed recently. I checked and it still exists on HEAD, so here's a proposed fix. Although this is marked as a Python backend bug, this is really about the completion mechanism used by GDB. Since this code reminds me of my first attempt to make a good noodle, it took me quite some time to fix it in a non-intrusive way. The problem is triggered when one registers a completion method inside a class in a Python script, rather than registering the command using a completer class directly. For example, consider the following script: class MyFirstCommand(gdb.Command): def __init__(self): gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME) def invoke(self,argument,from_tty): raise gdb.GdbError('not implemented') class MySecondCommand(gdb.Command): def __init__(self): gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER) def invoke(self,argument,from_tty): raise gdb.GdbError('not implemented') def complete(self,text,word): return gdb.COMPLETE_FILENAME MyFirstCommand () MySecondCommand () When one loads this into GDB and tries to complete filenames for both myfirstcommand and mysecondcommand, she gets: (gdb) myfirstcommand /hom<TAB> (gdb) myfirstcommand /home/ ^ ... (gdb) mysecondcommand /hom<TAB> (gdb) mysecondcommand /home ^ (The "^" marks the final position of the cursor after the TAB). So we see that myfirstcommand honors the COMPLETE_FILENAME class (as specified in the command creation), but mysecondcommand does not. After some investigation, I found that the problem lies with the set of word break characters that is used for each case. The set should be the same for both commands, but it is not. During the process of deciding which type of completion should be used, the code in gdb/completer.c:complete_line_internal analyses the command that requested the completion and tries to determine the type of completion wanted by checking which completion function will be called (e.g., filename_completer for filenames, location_completer for locations, etc.). This all works fine for myfirstcommand, because immediately after the command registration the Python backend already sets its completion function to filename_completer (which then causes the complete_line_internal function to choose the right set of word break chars). However, for mysecondcommand, this decision is postponed to when the completer function is evaluated, and the Python backend uses an internal completer (called cmdpy_completer). complete_line_internal doesn't know about this internal completer, and can't choose the right set of word break chars in time, which then leads to a bad decision when completing the "/hom" word. So, after a few attempts, I decided to create another callback in "struct cmd_list_element" that will be responsible for handling the case when there is an unknown completer function for complete_line_internal to work with. So far, only the Python backend uses this callback, and only when the user provides a completer method instead of registering the command directly with a completer class. I think this is the best option because it not very intrusive (all the other commands will still work normally), but especially because the whole completion code is so messy that it would be hard to fix this without having to redesign things. I have regtested this on Fedora 18 x86_64, without regressions. I also included a testcase. gdb/ChangeLog: 2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com> PR python/16699 * cli/cli-decode.c (set_cmd_completer_handle_brkchars): New function. (add_cmd): Set "completer_handle_brkchars" to NULL. * cli/cli-decode.h (struct cmd_list_element) <completer_handle_brkchars>: New field. * command.h (completer_ftype_void): New typedef. (set_cmd_completer_handle_brkchars): New prototype. * completer.c (set_gdb_completion_word_break_characters): New function. (complete_line_internal): Call "completer_handle_brkchars" callback from command. * completer.h: Include "command.h". (set_gdb_completion_word_break_characters): New prototype. * python/py-cmd.c (cmdpy_completer_helper): New function. (cmdpy_completer_handle_brkchars): New function. (cmdpy_completer): Adjust to use cmdpy_completer_helper. (cmdpy_init): Set completer_handle_brkchars to cmdpy_completer_handle_brkchars. gdb/testsuite/ChangeLog: 2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com> PR python/16699 * gdb.python/py-completion.exp: New file. * gdb.python/py-completion.py: Likewise.
2014-09-03Add NaCl (NativeClient) specific classes Target_mips_nacl andSasa Stankovic2-7/+75
Target_selector_mips_nacl. gold/ * mips.cc (Target_mips_nacl): New class. (Target_selector_mips_nacl): New class. (target_selector_mips32): Rename from target_selector_mips32be and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips32el): Rename from target_selector_mips32 and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips64): Rename from target_selector_mips64be and use Target_selector_mips_nacl instead of Target_selector_mips. (target_selector_mips64el): Rename from target_selector_mips64 and use Target_selector_mips_nacl instead of Target_selector_mips. (Target_mips::mips_info): Add const attribute.
2014-09-03[PATCH/AArch64] Generic support for all system registers using mrs and msrJiong Wang10-115/+75
2014-09-03 Jiong Wang <jiong.wang@arm.com> opcode/ * aarch64-tbl.h (aarch64_opcode_table): Update encoding for mrs/msr. * aarch64-dis-2.c: Update auto-generated file. gas/ * config/tc-aarch64.c (parse_sys_reg): Remove the restriction on op0 field. gas/testsuite/ * gas/aarch64/illegal.s: Update testcase. * gas/aarch64/illegal.d: Likewise. * gas/aarch64/sysreg-1.s: Likewise. * gas/aarch64/sysreg-1.d: Likewise.
2014-09-03[PATCH/AArch64] Implement LSE featureJiong Wang22-225/+3122
2014-09-03 Jiong Wang <jiong.wang@arm.com> gas/ * config/tc-aarch64.c (parse_operands): Recognize PAIRREG. (aarch64_features): Add entry for lse extension. include/opcode/ * aarch64.h (AARCH64_FEATURE_LSE): New feature added. (aarch64_opnd): Add AARCH64_OPND_PAIRREG. (aarch64_insn_class): Add lse_atomic. (F_LSE_SZ): New field added. (opcode_has_special_coder): Recognize F_LSE_SZ. opcode/ * aarch64-tbl.h (QL_R4NIL): New qualifiers. (aarch64_feature_lse): New feature added. (LSE): New Added. (aarch64_opcode_table): New LSE instructions added. Improve descriptions for ldarb/ldarh/ldar. (aarch64_opcode_table): Describe PAIRREG. * aarch64-opc.h (aarch64_field_kind): Add FLD_lse_sz. * aarch64-opc.c (fields): Add entry for F_LSE_SZ. (aarch64_print_operand): Recognize PAIRREG. (operand_general_constraint_met_p): Check reg pair constraints for CASP instructions. * aarch64-dis.c (aarch64_ext_regno_pair): New extractor for paired reg. (do_special_decoding): Recognize F_LSE_SZ. * aarch64-asm.c (do_special_encoding): Recognize F_LSE_SZ. gas/testsuite/ * gas/aarch64/lse-atomic.d: New. * gas/aarch64/lse-atomic.s: Likewise. * gas/aarch64/illegal-lse.d: Likewise. * gas/aarch64/illegal-lse.l: Likewise. * gas/aarch64/illegal-lse.s: Likewise. * gas/aarch64/diagnostic.s: Check processor feature detect for lse instruction. * gas/aarch64/diagnostic.l: Likewise.
2014-09-03x86 debug address register clarificationsGary Benson7-12/+27
The loop macro ALL_DEBUG_REGISTERS does not iterate over the status or control registers, so its name is misleading. This commit renames it as ALL_DEBUG_ADDRESS_REGISTERS and updates all uses. This commit also updates its loop conditions to an equivalent but better form, and makes two functions use it that had previously hardwired the loop. A comment on a related field in the x86_debug_reg_state structure is also updated to reflect that the field refers specifically to address registers only. gdb/ChangeLog: * nat/x86-dregs.h (ALL_DEBUG_REGISTERS): Renamed as... (ALL_DEBUG_ADDRESS_REGISTERS): New macro. All uses updated. Loop conditions changed to equivalent form. (struct x86_debug_reg_state): Updated dr_ref_count comment. * x86-linux-nat.c (x86_linux_prepare_to_resume): Use ALL_DEBUG_ADDRESS_REGISTERS. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_prepare_to_resume): Use ALL_DEBUG_ADDRESS_REGISTERS.
2014-09-03Fix dwarf2loc.h::dwarf2_evaluate_property function description.Joel Brobecker2-2/+7
gdb/ChangeLog: * dwarf2loc.h (dwarf2_evaluate_property): Minor function description fix.
2014-09-03daily updateAlan Modra1-1/+1
2014-09-02typeprint.c (find_global_typedef): Fix comment.Doug Evans2-2/+6
gdb/ChangeLog: * typeprint.c (find_global_typedef): Fix comment.
2014-09-02Make Elf_file::section_name() a const function, so that it can be used inCary Coutant10-17/+69
places where we have only a const Elf_file*. elfcpp/ * elfcpp_file.h (Elf_file::shnum): New const function. (Elf_file::shstrndx): New const function. (Elf_file::large_shndx_offset): New const function. (Elf_file::section_name): Add const attribute. (Elf_file::section_header_offset): Likewise. gold/ * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute. * dynobj.h (Sized_dynobj::do_section_name): Likewise. * incremental.cc (Sized_relobj_incr::do_section_name): Likewise. (Sized_incr_dynobj::do_section_name): Likewise. * incremental.h (Sized_relobj_incr::do_section_name): Likewise. (Sized_incr_dynobj::do_section_name): Likewise. * object.h (Object::section_name): Likewise. (Object::do_section_name): Likewise. (Sized_relobj_file::do_section_name): Likewise. * plugin.cc (Sized_pluginobj::do_section_name): Likewise. * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2014-09-02Fix problem with optimization of .eh_frame section and --sort-section option.Cary Coutant4-85/+72
When --sort-section=name is used, gold will sort the linker-generated contents of .eh_frame (after optimization) after the endcap provided by crtendS.o. This causes two problems: the .eh_frame_hdr section is generated assuming that the optimized .eh_frame contents will be placed at the very beginning of the section, and the endcap no longer appears at the end of the section. This patch fixes the first problem by adjusting FDE offsets to take into account the actual starting offset within the output section, and fixes the second problem by sorting linker-generated (Output_section_data) sections based on the name of the output section. gold/ PR gold/17005 * ehframe.cc (Fde::write): Add output_offset parameter. (Cie::write): Likewise. (Eh_frame::set_final_data_size): Account for offset within output section. (Eh_frame::do_sized_write): Likewise. * ehframe.h (Fde::write): Add output_offset parameter. (Cie::write): Likewise. * output.cc (Output_section::Input_section_sort_entry): Remove section_has_name_; add output_section_name parameter. Use output section name for non-input sections. (Output_section::Input_section_sort_entry::section_has_name): Remove. (Output_section::Input_section_sort_entry::section_has_name_): Remove. (Output_section::Input_section_sort_compare): Remove logic for sections without names. (Output_section::Input_section_sort_init_fini_compare): Likewise. (Output_section::Input_section_sort_section_prefix_special_ordering_compare): Likewise. (Output_section::Input_section_sort_section_name_compare): Likewise.
2014-09-02Rename 32- and 64-bit Intel files from "i386" to "x86"Gary Benson47-629/+664
This commit renames nine files that contain code used by both 32- and 64-bit Intel ports such that their names are prefixed with "x86" rather than "i386". All types, functions and variables within these files are likewise renamed such that their names are prefixed with "x86" rather than "i386". This makes GDB follow the convention used by gdbserver such that 32-bit Intel code lives in files called "i386-*", 64-bit Intel code lives in files called "amd64-*", and code for both 32- and 64-bit Intel lives in files called "x86-*". This commit only renames OS-independent files. The Linux ports of both GDB and gdbserver now follow the i386/amd64/x86 convention fully. Some ports still use the old convention where "i386" in file/function/ type/variable names can mean "32-bit only" or "32- and 64-bit" but I don't want to touch ports I can't fully test except where absolutely necessary. gdb/ChangeLog: * i386-nat.h: Renamed as... * x86-nat.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * i386-nat.c: Renamed as... * x86-nat.c: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * common/i386-xstate.h: Renamed as... * common/x86-xstate.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * nat/i386-cpuid.h: Renamed as... * nat/x86-cpuid.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * nat/i386-gcc-cpuid.h: Renamed as... * nat/x86-gcc-cpuid.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * nat/i386-dregs.h: Renamed as... * nat/x86-dregs.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * nat/i386-dregs.c: Renamed as... * nat/x86-dregs.c: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. gdb/gdbserver/ChangeLog: * i386-low.h: Renamed as... * x86-low.h: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated. * i386-low.c: Renamed as... * x86-low.c: New file. All type, function and variable name prefixes changed from "i386_" to "x86_". All references updated.
2014-09-02Use XCNEW rather than xcalloc (1, ...) in linux-x86-low.cGary Benson2-2/+7
This commit replaces two uses of xcalloc (1, ...) with XCNEW. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_new_process): Use XCNEW. (x86_linux_new_thread): Likewise.
2014-09-02daily updateAlan Modra1-1/+1
2014-09-01Move `_initialize_varobj' to the end of varobj.cMaciej W. Rozycki2-18/+22
* varobj.c (_initialize_varobj): Move to the end of file.
2014-09-01daily updateAlan Modra1-1/+1
2014-08-31daily updateAlan Modra1-1/+1
2014-08-29The 3rd patch for aarch64 gold.Han Shen4-56/+624
This enables - 1. static linking hello world 2. limited support for TLSIE and TLSLE 3. limited support for linking shared library, linking executable against shared library. gold/ChangeLog 2014-08-29 Han Shen <shenhan@google.com> Jing Yu <jingyu@google.com> * aarch64-reloc-property.cc (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in reference reloc property in the table. * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in 3 other entries. * aarch64.cc: (Output_data_got_aarch64::add_static_reloc): 2 new overloaded methods. (Output_data_got_aarch64::do_write): Add code to write out static relocs. (class Output_data_got_aarch64::Static_reloc): New class to wrap static relocs. (Output_data_got_aarch64::static_relocs): New vector to hold static relocs. (Target_aarch64::TCB_SIZE): New const static memeber. (Target_aarch64::tcb_size): New method. (Target_aarch64::Relocate::relocate): Add code handling new reloc types. (Target_aarch64::Relocate::relocate_tls): New method. (Target_aarch64::Scan::local): Add code handling new reloc types. (Target_aarch64::Scan::global): Add code handling new reloc types.
2014-08-30ppc476 patch area size miscalculationAlan Modra2-1/+5
ppc476 sections that end exactly on a page boundary need the workaround applied when a function ends in "bctr", or when pasting together code from multiple sections. The space allocated for the patch area didn't allow for this case, while the code in relocate_section performing the patches did, leading to an assertion failure. * elf32-ppc.c (ppc_elf_relax_section): Fix off by one error.
2014-08-30daily updateAlan Modra1-1/+1
2014-08-29Use exceptions and cleanups in gdbserverGary Benson4-97/+125
This commit replaces the hacky "exception" system in gdbserver with the exceptions and cleanups subsystem from GDB. Only the catch/cleanup code in what was "main" has been updated to use the new system. Other parts of gdbserver can now be converted to use TRY_CATCH and cleanups on an as-needed basis. A side-effect of this commit is that some error messages will change slightly, and in cases with multiple errors the error messages will be printed in a different order. gdb/gdbserver/ChangeLog: * server.h (setjmp.h): Do not include. (toplevel): Do not declare. (common-exceptions.h): Include. (cleanups.h): Likewise. * server.c (toplevel): Do not define. (exit_code): New static global. (detach_or_kill_for_exit_cleanup): New function. (main): New function. Original main renamed to... (captured_main): New function. * utils.c (verror) [!IN_PROCESS_AGENT]: Use throw_verror.
2014-08-29Introduce common/common-exceptions.[ch]Gary Benson9-438/+570
This commit moves the exception throwing and catching code into gdb/common/. All exception printing code remains in gdb/exceptions.[ch]. gdb/ChangeLog: * common/common-exceptions.h: New file. * common/common-exceptions.c: Likewise. * Makefile.in (SFILES): Add common/common-exceptions.c. (HFILES_NO_SRCDIR): Add common/common-exceptions.h. (COMMON_OBS): Add common-exceptions.o. (common-exceptions.o): New rule. * exceptions.h (common-exceptions.h): Include. (gdb_setjmp.h): Do not include. (return_reason): Moved to common-exceptions.h. (enum return_reason): Likewise. (RETURN_MASK): Likewise. (typedef return_mask): Likewise. (enum errors): Likewise. (struct gdb_exception): Likewise. (exceptions_state_mc_init): Likewise. (exceptions_state_mc_action_iter): Likewise. (exceptions_state_mc_action_iter_1): Likewise. (TRY_CATCH): Likewise. (throw_exception): Likewise. (throw_verror): Likewise. (throw_vquit): Likewise. (throw_error): Likewise. (throw_quit): Likewise. * exceptions.c (enum catcher_state): Moved to common-exceptions.c. (enum catcher_action): Likewise. (struct catcher): Likewise. (current_catcher): Likewise. (catcher_list_size): Likewise. (exceptions_state_mc_init): Likewise. (catcher_pop): Likewise. (exceptions_state_mc): Likewise. (exceptions_state_mc_action_iter): Likewise. (exceptions_state_mc_action_iter_1): Likewise. (throw_exception): Likewise. (exception_messages): Likewise. (exception_messages_size): Likewise. (throw_it): Likewise. (throw_verror): Likewise. (throw_vquit): Likewise. (throw_error): Likewise. (throw_quit): Likewise. (prepare_to_throw_exception): New function. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Add common/common-exceptions.c. (OBS): Add common-exceptions.o. (common-exceptions.o): New rule. * utils.c (prepare_to_throw_exception): New function.
2014-08-29Introduce common/gdb_setjmp.hGary Benson12-81/+148
This commit creates a new file, common/gdb_setjmp.h, to hold some portability macros for setjmp/longjmp et al. that are used by the exceptions subsystem and by the demangler crash catcher. gdb/ChangeLog: * common/gdb_setjmp.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_setjmp.h. * configure.ac: Move sigsetjmp check... * common/common.m4: ...here. * configure: Regenerate. * cp-support.c (SIGJMP_BUF): Delete. (SIGSETJMP): Likewise. (SIGLONGJMP): Likewise. * exceptions.h (gdb_setjmp.h): Include. (setjmp.h): Do not include. (EXCEPTIONS_SIGJMP_BUF): Delete. (EXCEPTIONS_SIGSETJMP): Likewise. (EXCEPTIONS_SIGLONGJMP): Likewise. Replace all uses of EXCEPTIONS_SIG* macros with SIG* macros from gdb_setjmp.h. * exceptions.c: Likewise. gdb/gdbserver/ChangeLog: * config.in: Regenerate. * configure: Likewise.
2014-08-29Move cleanups.[ch] to commonGary Benson6-6/+31
This commit moves cleanups.[ch] into gdb/common/. The only change to the content of the files is that cleanups.c's include list was altered to match its new location. gdb/ChangeLog: * cleanups.h: Moved to... * common/cleanups.h: New file. * cleanups.c: Moved to... * common/cleanups.c: New file. Include common-defs.h and cleanups.h. Do not include defs.h. * Makefile.in (SFILES): Replace cleanups.c with common/cleanups.c. (HFILES_NO_SRCDIR): Replace cleanups.h with common/cleanups.h. (cleanups.o): New rule. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Add common/cleanups.c. (OBS): cleanups.o. (cleanups.o): New rule.
2014-08-29Move internal_{,v}warning to common/errors.[ch]Gary Benson7-17/+51
This commit moves internal_warning and internal_vwarning into common/errors.[ch]. gdb/ChangeLog: * common/errors.h (internal_warning): New declaration. (internal_vwarning): Likewise. * common/errors.c (internal_warning): New function. * utils.h (internal_warning): Don't declare. (internal_vwarning): Likewise. * utils.c (internal_warning): Removed. gdb/gdbserver/ChangeLog: * utils.c (internal_vwarning): New function.
2014-08-29Unify startup and option-parsing warningsGary Benson2-21/+15
Various warnings are emitted during startup and option-parsing using fprintf_unfiltered. One warning is prefixed with the command name, the others are not. This commit replaces these hardwired warnings with calls to warning. It also sets warning_pre_print to prefix all warnings with the command name until option parsing is complete. gdb/ChangeLog: * main.c (captured_main): Use warning during startup. Prefix startup warning messages with command name.
2014-08-29Replace all usage errors with calls to errorGary Benson2-30/+14
This commit replaces the hardwired fprintf/exit error handlers for usage errors with calls to error. gdb/ChangeLog: * main.c (captured_main): Handle usage errors with error.
2014-08-29Replace hardwired error handler in go32_create_inferiorGary Benson2-6/+11
go32_create_inferior invokes a hardwired fprintf/exit error handler if v2loadimage fails. I could find no reason for this other than that the block seems to have been copy-and-pasted from v2loadimage's manpage. This commit replaces the hardwired handler with a call to error. gdb/ChangeLog: * go32-nat.c (go32_create_inferior): Replace a fprintf/ exit pair with a call to error. Wrap the message with _().
2014-08-29Replace hardwired error handler in captured_mainGary Benson2-6/+6
If the requested interpreter cannot be set captured_main reports the error with a hardwired fprintf/exit pair. A fprintf/exit pair on the previous line was replaced with a call to error in March 2003 (https://sourceware.org/ml/gdb-patches/2003-03/msg00444.html) but I found no documentation as to why this particular hardwired handler was left untouched. I was also unable to come up with a situation where error would not be suitable, so I have replaced it with a call to error. gdb/ChangeLog: * main.c (captured_main): Replace a fprintf/exit pair with a call to error. Wrap the message with _().
2014-08-29Replace hardwired error handlers in tui_initialize_ioGary Benson2-8/+9
tui_initialize_io contains a pair of hardwired fprintf/exit error handlers. I was unable to find any documentation as to why they're hardwired (the code appeared in a monolithic block back in 2001: https://sourceware.org/ml/gdb-patches/2001-07/msg00490.html) and I was also unable to come up with a situation where error would not be suitable, so I have replaced both handlers with calls to error. gdb/ChangeLog: * tui/tui-io.c (tui_initialize_io): Replace two fprintf/exit pairs with calls to error. Wrap the message with _().
2014-08-29Make warning usable earlierGary Benson2-2/+9
warning will crash if called before the first call to set_width. This commit makes the warning usable from the moment gdb_stderr is set up. gdb/ChangeLog: * utils.c (vwarning): Protect calls to target_terminal_ours and wrap_here.
2014-08-29Make error usable earlierGary Benson2-2/+10
error (and other exception-throwing functions) are callable from the first line of captured_main, but the exception printing code will crash if called before the first call to set_width. This commit makes the exception printing code usable from the moment gdb_stderr is set up. gdb/ChangeLog: * exceptions.c (print_flush): Protect calls to target_terminal_ours and wrap_here.
2014-08-29Make internal_vproblem always workGary Benson3-8/+51
internal_vproblem can be called (via malloc_failure) from almost the first line of captured_main, but it will crash if called before the first call to set_width. This commit makes internal_vproblem work at any time. There are two parts to this. If called before gdb_stderr is set up, internal_vproblem will fall back to printing the message on regular stderr and aborting. If called after gdb_stderr is set up but before filtered printing is set up, internal_vproblem will operate as usual except that it can not query whether to quit and/or dump core so it defaults to doing both. gdb/ChangeLog: * utils.h (filtered_printing_initialized): New declaration. * utils.c (abort_with_message): New function. (internal_vproblem): Use abort_with_message for first level recursive internal problems, and if gdb_stderr is not set up. Protect calls to target_terminal_ours, begin_line and query.
2014-08-29PowerPC64 call lacks nop errorAlan Modra2-4/+16
* elf64-ppc.c (ppc64_elf_relocate_section): Report a different error for calls via a toc adjusting stub without a nop.
2014-08-29Prevent alpha_vms_object_p stopping bfd_check_format_matches scanAlan Modra2-9/+7
Any error other than bfd_error_wrong_format returned from object_p() is effectively a fatal error. * vms-alpha.c (alpha_vma_object_p): Don't return file_truncated error. Remove redundant bfd_set_error.
2014-08-29Report an error for S-records with less than the miniumum sizeAlan Modra2-3/+20
* srec.c (srec_scan): Revert last change. Report an error for S-records with less than the miniumum byte count.
2014-08-29Fix testsuite ld_simple_link_defsyms for windows targetsAlan Modra2-2/+7
* lib/ld-lib.exp (ld_simple_link_defsyms): Provide both __main and ___main for windows targets.
2014-08-29daily updateAlan Modra1-1/+1
2014-08-28Move definition of some prologue-related functions to a better location.Doug Evans2-187/+192
gdb/ChangeLog: * symtab.c (in_prologue): Move definition to better spot. (skip_prologue_using_sal): Ditto.
2014-08-28symtab.c (find_function_start_sal): Move definition to better spot.Doug Evans2-32/+36
gdb/ChangeLog: * symtab.c (find_function_start_sal): Move definition to better spot.
2014-08-28Rewrite {amd64,i386}-pseudo.c to better specify register liveness.Doug Evans3-23/+59
clang was using eax to construct %0 here: asm ("mov %%eax, 0(%0)\n\t" "mov %%ebx, 4(%0)\n\t" "mov %%ecx, 8(%0)\n\t" "mov %%edx, 12(%0)\n\t" "mov %%esi, 16(%0)\n\t" "mov %%edi, 20(%0)\n\t" : /* no output operands */ : "r" (data) : "eax", "ebx", "ecx", "edx", "esi", "edi"); which caused amd64-word.exp (and others similarly) to fail. It's a perfectly legit thing for clang to do given the available data. The patch fixes this by marking the registers as live from the time of the preceding breakpoint. gdb/testsuite/ChangeLog: * gdb.arch/amd64-pseudo.c (main): Rewrite to better specify when eax,etc. are live with values set by gdb and thus the compiler can't use them. * gdb.arch/i386-pseudo.c (main): Ditto.