Pedro Alves [Wed, 22 Oct 2014 11:26:06 +0000 (12:26 +0100)]
breakpoint.h: move enum ‘print_stop_action’
Building GDB in C++, we get:
src/gdb/breakpoint.h:529:8: error: use of enum ‘print_stop_action’ without previous declaration
We can't forward declare enums in C++.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* breakpoint.h (enum print_stop_action): Move further up in the
file.
Pedro Alves [Wed, 22 Oct 2014 11:16:56 +0000 (12:16 +0100)]
gdbarch.h: include regcache.h
Building GDB in C++ mode, I got:
src/gdb/gdbarch.h:240:149: error: invalid type in declaration before ‘;’ token
src/gdb/gdbarch.h:240:14: error: use of enum ‘register_status’ without previous declaration
src/gdb/gdbarch.h:241:13: error: use of enum ‘register_status’ without previous declaration
src/gdb/gdbarch.h:241:140: error: invalid type in declaration before ‘;’ token
That's because 'enum register_status' has not been declared (and we can't
forward declare enums in C++).
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* gdbarch.sh: Include regcache.h.
* gdbarch.h: Regenerate.
Pedro Alves [Wed, 22 Oct 2014 04:58:23 +0000 (05:58 +0100)]
Remove duplicate const
Building --enable-targets=all in C++ mode fails with:
gdb/sparc-sol2-tdep.c:179:7: error: duplicate ‘const’
gdb/arm-tdep.c:13878:33: error: duplicate ‘const’
gdb/arm-tdep.c:13891:33: error: duplicate ‘const’
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* arm-tdep.c (decode_insn) <arm_handle_insn, thumb_handle_insn>:
Remove duplicate const.
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Remove
duplicate const.
Pedro Alves [Mon, 9 Feb 2015 13:22:27 +0000 (13:22 +0000)]
Exported const objects
const works different in C vs C++. In C++, a global "const" variable
has internal linkage by default, resulting in link errors like:
...
extension.o: In function `get_ext_lang_defn(extension_language)':
gdb/extension.c:126: undefined reference to `extension_language_guile'
gdb/extension.c:124: undefined reference to `extension_language_guile'
...
The fix is to define exported const objects with "extern const". But
that in C would not be a definition. So we need to #ifdef C vs C++ in
this case.
EXPORTED_CONST comes from include/ansidecl.h, but in the
feature_to_c.sh case I think it's better to leave the script with no
dependencies.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* cp-valprint.c (vtbl_ptr_name): Use EXPORTED_CONST.
* guile/guile.c (extension_language_guile): Use EXPORTED_CONST.
* features/feature_to_c.sh: Tag the generated xml_builtin array
with extern const in C++ mode.
Tom Tromey [Thu, 5 Jun 2014 20:36:27 +0000 (14:36 -0600)]
Rename struct lzma_stream to avoid clash with system header
/home/pedro/gdb/mygit/src/gdb/minidebug.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/minidebug.c:55:8: error: using typedef-name ‘lzma_stream’ after ‘struct’
struct lzma_stream
^
In file included from /usr/include/lzma.h:281:0,
from /home/pedro/gdb/mygit/src/gdb/minidebug.c:28:
/usr/include/lzma/base.h:498:3: note: ‘lzma_stream’ has a previous declaration here
} lzma_stream;
^
gdb/ChangeLog:
2015-02-27 Tom Tromey <tromey@redhat.com>
* minidebug.c (struct lzma_stream): Rename to ...
(struct gdb_lzma_stream): ... this.
(lzma_open, lzma_pread, lzma_close, lzma_stat): Adjust.
Pedro Alves [Wed, 22 Oct 2014 04:09:07 +0000 (05:09 +0100)]
mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
The enums are value compatible by design, but building in C++ mode trips
on them, like:
...
gdb/mi/mi-cmd-stack.c:363:34: error: cannot convert ‘print_values’ to ‘ext_lang_frame_args’ for argument ‘3’ to ‘ext_lang_bt_status apply_ext_lang_frame_filter(frame_info*, int, ext_lang_frame_args, ui_out*, int, int)’
...
Fix this by adding a helper function.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): New
function.
(mi_cmd_stack_list_locals, mi_cmd_stack_list_args)
(mi_cmd_stack_list_variables): Use it.
Pedro Alves [Wed, 22 Oct 2014 12:51:07 +0000 (13:51 +0100)]
x86 Linux/ptrace: fix offsetof usage in C++ mode
In C++ mode, we get:
gdb/gdbserver/linux-x86-low.c: In function ‘void x86_linux_dr_set(ptid_t, int, long unsigned int)’:
gdb/gdbserver/linux-x86-low.c:558:38: error: ‘regnum’ cannot appear in a constant-expression
offsetof (struct user, u_debugreg[regnum]), value);
^
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (u_debugreg_offset): New function.
(x86_linux_dr_get, x86_linux_dr_set): Use it.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* x86-linux-nat.c (u_debugreg_offset): New function.
(x86_linux_dr_get, x86_linux_dr_set): Use it.
Pedro Alves [Sun, 19 Oct 2014 23:06:55 +0000 (00:06 +0100)]
Don't forward declare enum target_hw_bp_type
Can't do that in C++.
2015-02-27 Pedro Alves <palves@redhat.com>
* nat/x86-dregs.h (enum target_hw_bp_type): Remove forward
declaration.
Include break-common.h.
Tom Tromey [Wed, 22 Oct 2014 05:08:20 +0000 (06:08 +0100)]
Do not increment of decrement enums
In C++, we can't do arithmetic on enums. This patch fixes build errors like:
src/gdb/i386-tdep.c: In function ‘int i386_stap_parse_special_token(gdbarch*, stap_parse_info*)’:
src/gdb/i386-tdep.c:4309:7: error: no match for ‘operator++’ (operand type is ‘i386_stap_parse_special_token(gdbarch*, stap_parse_info*)::<anonymous enum>’)
++current_state;
^
...
src/gdb/rs6000-tdep.c:4265:18: error: no match for ‘operator++’ (operand type is ‘powerpc_vector_abi’)
src/gdb/arm-tdep.c:9428:71: error: no match for ‘operator++’ (operand type is ‘arm_float_model’)
src/gdb/arm-tdep.c:9465:64: error: no match for ‘operator++’ (operand type is ‘arm_abi_kind’)
...
gdb/ChangeLog:
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* arm-tdep.c (set_fp_model_sfunc, arm_set_abi): Use 'int' for
local used to iterate over enums.
* completer.c (signal_completer): Likewise.
* i386-tdep.c (i386_stap_parse_special_token): Likewise.
* rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
* tui/tui-data.c (tui_next_win, tui_prev_win): Likewise.
* tui/tui-layout.c (next_layout, prev_layout): Likewise.
* tui/tui-win.c (tui_refresh_all_win, tui_rehighlight_all)
(tui_resize_all, tui_set_focus_command, tui_all_windows_info): Likewise.
* tui-wingeneral.c (tui_refresh_all): Likewise.
Pedro Alves [Wed, 22 Oct 2014 03:35:38 +0000 (04:35 +0100)]
target.h: Include infrun.h
Fixes:
src/gdb/target.h:753:10: error: use of enum ‘exec_direction_kind’ without previous declaration
in C++ mode. We can't forward declare enums.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* target.h: Include "infrun.h".
Pedro Alves [Mon, 9 Feb 2015 14:59:09 +0000 (14:59 +0000)]
proc-service, extern "C"
libthread_db.so calls symbols in the client (GDB), through the
proc-service interface. These routines must have extern "C" linkage
so their symbol names are not mangled when GDB is built as a C++
program. On the GDBserver side, we were missing fallback declarations for
all these symbols.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
[!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
[!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
(ps_lsetfpregs, ps_getpid)
(ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
(ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
(ps_lsetxregs, ps_plog): Declare.
Pedro Alves [Mon, 9 Feb 2015 14:59:08 +0000 (14:59 +0000)]
Make functions and variables exported by the IPA be extern "C"
Functions and variables that are exported by the IPA DSO (that
GDBserver needs to look up) should have "C" mangling, thus be declared
with extern "C".
Function and variable declarations need the extern "C" marker, but
variable definitions can't be marked extern, so the patch splits
IP_AGENT_EXPORT into three.
Building in C++ mode revealed that a few variables were missing
IP_AGENT_EXPORT, thus the IPA has been broken when stripped, even in C
mode... So this ends being a bug fix as well.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* common/agent.h (IPA_SYM_EXPORTED_NAME): New.
(IPA_SYM): Use it.
* common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros.
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use
IP_AGENT_EXPORT_FUNC.
* linux-i386-ipa.c (gdb_agent_get_raw_reg): Use
IP_AGENT_EXPORT_FUNC.
* tracepoint.c (ATTR_USED, ATTR_NOINLINE, ATTR_CONSTRUCTOR)
(IP_AGENT_EXPORT): Delete.
(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
(gdb_trampoline_buffer_error, collecting, gdb_collect)
(stop_tracing, flush_trace_buffer, about_to_request_buffer_space)
(trace_buffer_is_full, stopping_tracepoint, expr_eval_result)
(error_tracepoint, tracepoints, tracing, trace_buffer_ctrl)
(trace_buffer_ctrl_curr, trace_buffer_lo, trace_buffer_hi)
(traceframe_read_count, traceframe_write_count)
(traceframes_created, trace_state_variables, get_raw_reg)
(get_trace_state_variable_value, set_trace_state_variable_value)
(ust_loaded, helper_thread_id, cmd_buf): Use
IPA_SYM_EXPORTED_NAME.
(stop_tracing, flush_trace_buffer): Use IP_AGENT_EXPORT_FUNC.
(tracepoints) Use IP_AGENT_EXPORT_VAR.
(stopping_tracepoint, trace_buffer_is_full, expr_eval_result): Use
IP_AGENT_EXPORT_VAR and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(last_tracepoint): Move into !IN_PROCESS_AGENT block.
(error_tracepoint): Use IP_AGENT_EXPORT_VAR and wrap in
EXTERN_C_PUSH/EXTERN_C_POP.
(trace_state_variables): Use IP_AGENT_EXPORT_VAR.
(trace_buffer_lo, trace_buffer_hi): Use IP_AGENT_EXPORT_VAR and
wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(trace_buffer_ctrl, trace_buffer_ctrl_curr)
(traceframe_write_count, traceframe_read_count)
(traceframes_created, tracing): Use IP_AGENT_EXPORT_VAR.
(about_to_request_buffer_space, get_trace_state_variable_value)
(set_trace_state_variable_value): Use IP_AGENT_EXPORT_FUNC.
(collecting): Use IP_AGENT_EXPORT_VAR and wrap in
EXTERN_C_PUSH/EXTERN_C_POP.
(gdb_collect): Use IP_AGENT_EXPORT_FUNC.
(ust_loaded, cmd_buf): Use IP_AGENT_EXPORT_VAR.
(helper_thread_id, gdb_agent_capability): Use IP_AGENT_EXPORT_VAR
and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
(gdb_trampoline_buffer_error): Use IP_AGENT_EXPORT_VAR.
* tracepoint.h (ATTR_USED, ATTR_NOINLINE, EXPORTED_SYMBOL):
Define.
(IP_AGENT_EXPORT_FUNC, IP_AGENT_EXPORT_VAR)
(IP_AGENT_EXPORT_VAR_DECL): Define.
(tracing): Declare.
(gdb_agent_get_raw_reg): Declare.
Pedro Alves [Mon, 9 Feb 2015 14:59:08 +0000 (14:59 +0000)]
Add extern "C" to declarations of C symbols
These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them. As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* cli-out.c (_rl_erase_entire_line): Move declaration out of
cli_mld_erase_entire_line, and make it extern "C".
* common/common-defs.h (EXTERN_C): New.
* completer.c (_rl_completion_prefix_display_length)
(_rl_print_completions_horizontally, QSFUNC): Move declarations
out of gdb_display_match_list_1.
(_rl_qsort_string_compare): Move declaration out of
gdb_display_match_list_1, and make it extern "C".
* defs.h (re_comp): Use EXTERN_C.
* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
and make it extern "C".
(monstartup): Move declaration out of maintenance_set_profile_cmd,
and make it extern "C".
(main): Move declaration out of maintenance_set_profile_cmd.
* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
EXTERN_C.
Pedro Alves [Mon, 9 Feb 2015 14:59:06 +0000 (14:59 +0000)]
Make array object extern
Compiling python.c in C++ mode, we get:
...src/gdb/python/python.c: At global scope:
...src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
static PyMethodDef GdbMethods[];
^
Fix it by making the affected array objects extern.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* python/python.c (GdbMethods): Rename to ...
(python_GdbMethods): ... this and make extern.
(GdbModuleDef): Rename to ...
(python_GdbModuleDef): ... this and make extern.
Pedro Alves [Mon, 9 Feb 2015 17:13:39 +0000 (17:13 +0000)]
record-btrace.c: Remove redefinitions
The set_record_btrace_cmdlist and show_record_btrace_cmdlist objects
are declared twice in the file, seemingly a simply copy/paste
oversight. In C, the first time counts as forward declaration, but in
C++, they are all definitions. That results in:
src/gdb/record-btrace.c:80:33: error: redefinition of ‘cmd_list_element* set_record_btrace_cmdlist’
src/gdb/record-btrace.c:61:33: error: ‘cmd_list_element* set_record_btrace_cmdlist’ previously declared here
src/gdb/record-btrace.c:81:33: error: redefinition of ‘cmd_list_element* show_record_btrace_cmdlist’
src/gdb/record-btrace.c:62:33: error: ‘cmd_list_element* show_record_btrace_cmdlist’ previously declared here
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* record-btrace.c (set_record_btrace_cmdlist)
(show_record_btrace_cmdlist): Remove redefinitions.
---
gdb/record-btrace.c | 4 ----
1 file changed, 4 deletions(-)
Tom Tromey [Mon, 9 Feb 2015 14:59:05 +0000 (14:59 +0000)]
Fix struct, union, and enum nesting in C++
In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place. However, in C++, such a nested structure is given a name that
is nested inside the structure. This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.
gdb/ChangeLog:
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (enum cfa_how_kind, struct
dwarf2_frame_state_reg_info): Move out of struct
dwarf2_frame_state.
* dwarf2read.c (struct tu_stats): Move out of struct
dwarf2_per_objfile.
(struct file_entry): Move out of struct line_header.
(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
typedef_field_list): Move out of struct field_info.
* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
Move out of struct dynamic_prop.
(union type_owner, union field_location, struct field, struct
range_bounds, union type_specific): Move out of struct main_type.
(struct fn_fieldlist, struct fn_field, struct typedef_field)
(VOFFSET_STATIC): Move out of struct cplus_struct_type.
(struct call_site_target, union call_site_parameter_u, struct
call_site_parameter): Move out of struct call_site.
* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
m32c_prologue.
(enum srcdest_kind): Move out of struct srcdest.
* main.c (enum cmdarg_kind): Move out of struct cmdarg.
* prologue-value.h (enum prologue_value_kind): Move out of struct
prologue_value.
* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
gdbarch_tdep.
* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
out of struct field_info.
* symfile.h (struct other_sections): Move out of struct
section_addr_info.
* symtab.c (struct symbol_cache_slot): Move out struct
block_symbol_cache.
* target-descriptions.c (enum tdesc_type_kind): Move out of
typedef struct tdesc_type.
* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
struct tui_line_or_address.
* value.c (enum internalvar_kind, union internalvar_data): Move
out of struct internalvar.
* xtensa-tdep.h (struct ctype_cache): Move out of struct
gdbarch_tdep.
Pedro Alves [Fri, 27 Feb 2015 16:33:07 +0000 (16:33 +0000)]
C++ keyword cleanliness, mostly auto-generated
This patch renames symbols that happen to have names which are
reserved keywords in C++.
Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output. I don't think that matters anyway.
gdb/
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
Rename symbols whose names are reserved C++ keywords throughout.
gdb/gdbserver/
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
Rename symbols whose names are reserved C++ keywords throughout.
Pedro Alves [Fri, 27 Feb 2015 13:11:25 +0000 (13:11 +0000)]
Add --enable-build-with-cxx configure switch
This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.
The name of the switch should be familiar to those who followed GCC's
own C++ conversion process.
. Adding -fpermissive to COMPILER in C++ mode (see the new
build-with-cxx.m4 file) makes errors like these be warnings instead:
gdb/infrun.c:6597:1: error: initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
sig_print_info (enum gdb_signal oursig)
^
gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
restore_infcall_suspend_state (state);
^
so that the compiler carries on compiling the file. -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other more important things out of
the way first.
There's no way to quiet those warnings. Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.
. Adding -Wno-narrowing suppresses thousands of instances of this warning:
gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
We can defer handling those until we target C++11.
. Adding -Wno-sign-compare suppresses thousands of instances of this warning:
gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (tmpulongest == tdep->fcntl_F_GETLK64)
^
. Adding -Wno-write-strings suppresses thousands of instances of this warning:
gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
attstr = "editable";
^
gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
attstr = "noneditable";
^
For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus start building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER): New, get it from autoconf.
(COMPILE.pre, CC_LD): Use COMPILER.
(CXX): Get from autoconf instead.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* build-with-cxx.m4: New file.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode. Only enable -Wpointer-sign in C mode.
Run supported-warning-flags tests with the C++ compiler.
Save/restore CXXFLAGS too.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER): New, get it from autoconf.
(CXX): Get from autoconf instead.
(COMPILE.pre): Use COMPILER.
(CC-LD): Rename to ...
(CC_LD): ... this. Use COMPILER.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode. Run supported-warning-flags tests with
the C++ compiler. Save/restore CXXFLAGS too.
* configure: Regenerate.
Nick Clifton [Fri, 27 Feb 2015 16:19:57 +0000 (16:19 +0000)]
Fixes a problem with the linker script parser not always handling the ! character in memort region attributes.
PR ld/17900
* ldlang.c (lang_set_flags): Allow exclamation mark to reverse the
sense of the following memory region attribute characters.
Pedro Alves [Fri, 27 Feb 2015 15:52:02 +0000 (15:52 +0000)]
Create libiberty.m4, have GDB and GDBserver use it
Converting GDB to be a C++ program, I stumbled on 'basename' issues,
like:
src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
/usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’
which I believe led to this bit in gold's configure.ac:
dnl We have to check these in C, not C++, because autoconf generates
dnl tests which have no type information, and current glibc provides
dnl multiple declarations of functions like basename when compiling
dnl with C++.
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
that libiberty.h and ansidecl.h check.
GDB is missing these checks currently, which results in the conflict
shown above.
This adds an m4 file that both GDB and GDBserver's configury use to
pull in the autoconf checks that libiberty clients needs done in order
to use these libiberty.h/ansidecl.h.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* libiberty.m4: New file.
* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.
gdb/gdbserver/
2015-02-27 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.
Nick Clifton [Fri, 27 Feb 2015 15:38:32 +0000 (15:38 +0000)]
Fixes a problem recognizing libraries created by Visual Studio.
PR binutils/17910
* coffgen.c (_bfd_coff_internal_syment_name): Only check for
string length overflow when the string table length is actually
set.
Pedro Alves [Fri, 27 Feb 2015 13:54:22 +0000 (13:54 +0000)]
Add "../lib/unbuffer_output.c" and use it in gdb.base/interrupt.c
In some scenarios, GDB or GDBserver can be spawned with input _not_
connected to a tty, and then tests that rely on stdio fail with
timeouts, because the inferior's stdout and stderr streams end up
fully buffered.
See discussion here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00809.html
We have a hack in place that works around this for Windows testing,
that forces every test program to link with an .o file that does
(lib/set_unbuffered_mode.c):
static int __gdb_set_unbuffered_output (void) __attribute__ ((constructor));
static int
__gdb_set_unbuffered_output (void)
{
setvbuf (stdout, NULL, _IONBF, BUFSIZ);
setvbuf (stderr, NULL, _IONBF, BUFSIZ);
}
That's a bit hacky; it ends up done for _all_ tests.
This patch adds a way to do this unbuffering explicitly from the test
code itself, so it is done only when necessary, and for all
targets/hosts. For starters, it adjusts gdb.base/interrupt.c to use
it.
Tested on x86_64 Fedora 20, native, and against a remote gdbserver
board file that connects to the target with ssh, with and without -t
(create pty).
gdb/testsuite/
2015-02-27 Pedro Alves <palves@redhat.com>
* lib/unbuffer_output.c: New file.
* gdb.base/interrupt.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
Yao Qi [Fri, 27 Feb 2015 13:45:06 +0000 (13:45 +0000)]
Don't skip catch-syscall.exp on hppa*-hp-hpux* target
As far as I know, "catch syscall" is supported on hppa*-hp-hpux*, but
the test catch-syscall.exp is skipped on this target by mistake. This
patch is to fix it. However, I don't have a hpux machine to test.
gdb/testsuite:
2015-02-27 Yao Qi <yao.qi@linaro.org>
* gdb.base/catch-syscall.exp: Don't skip it on hppa*-hp-hpux*
target.
Marcus Shawcroft [Fri, 27 Feb 2015 12:21:54 +0000 (12:21 +0000)]
Regenerate bfd-in2.h and libbfd.h
Nick Clifton [Fri, 27 Feb 2015 09:49:20 +0000 (09:49 +0000)]
Fixes problems building the V850 simulator introduced with the previous delta.
* sim-main.h (reg64_t): New type.
(v850_regs): Add selID_sregs field.
(VR, SAT16, SAT32, ABS16, ABS32 ): New macros.
* v850-dc: Add fields for v850e3v5 instructions.
* v850.igen (cvtf.dl): Use correctly signed local value.
(cvtf.dw, cvtf.sw, trncf.dul, trncf.dl, trncf.sul, trncf.sw):
Likewise.
* interp.c: Fix old style function declarations.
* simops.c: Likewise.
Andreas Arnez [Fri, 27 Feb 2015 09:47:54 +0000 (10:47 +0100)]
S390: Fix compiler invocation with "compile" command
On 64-bit S390 platforms the "compile" command always failed because
gcc was not invoked correctly. This patch fixes the compiler
invocation.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_gcc_target_options): Not just handle
31-bit targets, but 64-bit targets as well.
(s390_gnu_triplet_regexp): New function.
(s390_gdbarch_init): Set the gcc_target_options gdbarch method for
64-bit targets as well. Set the gnu_triplet_regexp gdbarch
method.
Joel Brobecker [Fri, 27 Feb 2015 08:49:59 +0000 (09:49 +0100)]
Mark latest entry in gdb/ChangeLog as "(tiny patch)".
Jon TURNEY [Wed, 18 Feb 2015 23:13:47 +0000 (23:13 +0000)]
Retrieve segment registers on Windows amd64
For amd64, CONTEXT_FULL does not contain CONTEXT_SEGMENTS, which seems
to be needed to retrieve all the segment registers. Add it explicitly,
with a little de-cruftification.
The value of the segment registers isn't terribly useful on amd64, but
at least this makes the output of 'info registers' correct.
Before:
(gdb) i r cs ss ds es fs gs
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
After:
(gdb) i r cs ss ds es fs gs
cs 0x33 51
ss 0x2b 43
ds 0x2b 43
es 0x2b 43
fs 0x53 83
gs 0x2b 43
gdb/ChangeLog
2015-02-27 Jon TURNEY <jon.turney@dronecode.org.uk>
* windows-nat.c (CONTEXT_DEBUGGER): Remove.
(CONTEXT_DEBUGGER_DR): Add CONTEXT_SEGMENTS. Incorporate flags
from CONTEXT_DEBUGGER.
Marcus Shawcroft [Fri, 27 Feb 2015 08:07:55 +0000 (08:07 +0000)]
Adjust ChangeLog entry.
Doug Evans [Fri, 27 Feb 2015 01:31:29 +0000 (17:31 -0800)]
Add missing CHECK_TYPEDEF calls to recent vptr_{fieldno,basetype} cleanup.
gdb/ChangeLog:
* gdbtypes.c (internal_type_vptr_fieldno): Add missing call to
CHECK_TYPEDEF.
(set_type_vptr_fieldno): Ditto.
(internal_type_vptr_basetype, set_type_vptr_basetype): Ditto.
* gnu-v3-abi.c (gnuv3_dynamic_class): Ditto.
gdb/testsuite/ChangeLog:
* gdb.cp/class2.cc (Dbase, D): New classes.
(main): New local delta.
* gdb.cp/class2.exp: Test printing delta.
* gdb.cp/classes.cc (DynamicBase2, DynamicBar): New classes.
(dynbar): New global.
* gdb.cp/classes.exp (test_ptype_class_objects): Test ptype DynamicBar.
Alan Modra [Thu, 26 Feb 2015 02:31:50 +0000 (13:01 +1030)]
Fix recent h8300 configury changes
* Makefile.am (ALL_EMULATION_SOURCES): Sort new h8300 entries.
(eh8300elf_linux.c, eh8300helf_linux.c, eh8300self_linux.c,
eh8300sxelf_linux.c): Do not invoke genscripts here.
* Makefile.in: Regenerate.
GDB Administrator [Fri, 27 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Marcus Shawcroft [Thu, 19 Feb 2015 09:52:24 +0000 (09:52 +0000)]
[AArch64] Add tiny DESC test cases.
Marcus Shawcroft [Wed, 18 Feb 2015 15:37:35 +0000 (15:37 +0000)]
[AArch64] Add support for :tlsdesc: and TLSDESC_LD_PREL19
Marcus Shawcroft [Wed, 18 Feb 2015 15:36:40 +0000 (15:36 +0000)]
[AArch64] Add support for :tlsdesc: and TLSDESC_ADR_PREL21
Marcus Shawcroft [Thu, 19 Feb 2015 09:10:11 +0000 (09:10 +0000)]
Add tiny memory model GD test cases.
Marcus Shawcroft [Fri, 13 Feb 2015 07:13:57 +0000 (07:13 +0000)]
Add ADR :tlsgd: directive and TLSGD_ADR_PREL21 support.
Marcus Shawcroft [Wed, 18 Feb 2015 18:10:59 +0000 (18:10 +0000)]
Adding tls-tiny-ie test.
Marcus Shawcroft [Fri, 13 Feb 2015 09:57:11 +0000 (09:57 +0000)]
Adding support for TLSIE_LD_GOTTREL_PREL19.
Marcus Shawcroft [Wed, 18 Feb 2015 18:10:27 +0000 (18:10 +0000)]
Adding ld_literal_type.
Extend the address modifier parsing to distinguish between the
modifers used in LDR literal and LDR register offset address modes.
The current parser incorrectly accepts the :got: modifier on a
register offset instruction resulting in silent corruption of the
output binary.
Marcus Shawcroft [Wed, 18 Feb 2015 18:32:43 +0000 (18:32 +0000)]
Adding test case for abuse of :got: in offset load
The :got: modifier is not meaningful in a register offset load store
instruction and should result in a diagnostic.
Marcus Shawcroft [Thu, 5 Feb 2015 16:57:09 +0000 (16:57 +0000)]
Adding adr_type and prevent adr :got:
The current implementation of the :got: assembler modifier does not
distinguish the ADR and ADRP instruction. The :got: modifier does not
make sense on and ADR instruction and should be error'd rather than
the current behavior of applying an inappropriate relocation to the
output and scrambling the underlying instruction silently.
Marcus Shawcroft [Thu, 5 Feb 2015 13:16:33 +0000 (13:16 +0000)]
Add test case for ADR :got:foo
The modifier :got: does not make sense on an ADR instruction. Add a
test case to ensure we gripe.
Marcus Shawcroft [Wed, 18 Feb 2015 15:08:34 +0000 (15:08 +0000)]
Fix field size for TLSDESC_CALL
This relocation is a marker and does not result in a modification to
the binary. Changing the HOWTO bit field width to reflect this
property.
Marcus Shawcroft [Thu, 26 Feb 2015 21:20:05 +0000 (21:20 +0000)]
Fix field size for TLSLE_MOVW_TPREL_* relocations.
The HOWTO table entries for the TLSLE_MOVW_TPREL_* relocations are
wrong by inspection. The current implementation does not actually use
these field widths for these relocations but they should be corrected.
Marcus Shawcroft [Wed, 18 Feb 2015 15:00:27 +0000 (15:00 +0000)]
Fix TLSIE_MOVW_GOTTPREL_G0_NC field size.
Marcus Shawcroft [Fri, 13 Feb 2015 06:02:52 +0000 (06:02 +0000)]
Remove dead code.
Nick Clifton [Thu, 26 Feb 2015 22:16:16 +0000 (22:16 +0000)]
Fix arithmetic overflows running srconv on fuzzed binaries.
PR binutils/17512
* coffgrok.c (do_type): Check for an out of range tag index.
Check for integer overflow computing array dimension.
(do_define): Likewise.
Nick Clifton [Thu, 26 Feb 2015 21:32:04 +0000 (21:32 +0000)]
Fixes illegal memory access errors and arithmetic overflows when running strip on fuzzed binaries.
PR binutils/17512
* coffcode.h (coff_compute_section_file_positions): Report
negative page sizes.
* elf.c (elf_fake_sections): Handle excessive alignmment powers.
(assign_file_positions_for_non_load_sections): Replace assertion
with an error message.
(rewrite_elf_program_header): Handle excessive segment
alignments.
* mach-o.c (bfd_mach_o_read_section_32): Likewise.
(bfd_mach_o_read_section_64): Likewise.
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Use %B to
print a bfd name, not %A.
Pedro Alves [Thu, 26 Feb 2015 18:48:46 +0000 (18:48 +0000)]
gdbserver/Linux: Simplify stepping past program breakpoint a little
.decr_pc_after_break is never higher than .breakpoint_len, so use
.breakpoint_len directly. Based on idea from Yao here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00689.html
gdb/gdbserver/ChangeLog:
2015-02-26 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_wait_1): When incrementing the PC past a
program breakpoint always use the_low_target.breakpoint_len as
increment, rather than the maximum between that and
the_low_target.decr_pc_after_break.
Pedro Alves [Thu, 26 Feb 2015 18:29:12 +0000 (18:29 +0000)]
Add ATTRIBUTE_PRINTF attributes, and fix fallout
Fixes building gdb on x86_64-apple-darwin14 with clang, which produces
a number of warnings from -Wformat-nonliteral.
Ref: https://sourceware.org/ml/gdb/2015-02/msg00047.html
gdb/ChangeLog:
2015-02-26 Pedro Alves <palves@redhat.com>
* auto-load.h (file_is_auto_load_safe): Add ATTRIBUTE_PRINTF.
* complaints.c (vcomplaint): Pass argument FMT directly to
printf-like functions instead of complaint->fmt.
* ctf.c (ctf_save_write_metadata): Add ATTRIBUTE_PRINTF.
* darwin-nat.c (inferior_debug): Add ATTRIBUTE_PRINTF.
* compile/compile-loc2c.c (pushf, unary, binary): Add
ATTRIBUTE_PRINTF.
(do_compile_dwarf_expr_to_c): Pass string literal as format string
to pushf.
(BINARY): Pass string literal as format string to 'binary'.
* compile/compile-object-load.c (link_callbacks_einfo): Add
ATTRIBUTE_PRINTF.
* guile/guile-internal.h (gdbscm_printf): Add ATTRIBUTE_PRINTF.
Andrew Burgess [Thu, 26 Feb 2015 17:17:46 +0000 (17:17 +0000)]
objcopy: Avoid shadowing optarg.
In commit
7173b38a442c007a554ea200817a0eadce89c87b I used optarg as the
name for a function parameter, shadowing the global of that name. This
commit changes the function parameter to be called arg.
binutils/ChangeLog:
* objcopy.c (init_section_add): Rename optarg to arg in order to
avoid shadowing a global variable.
Pedro Alves [Thu, 26 Feb 2015 17:13:58 +0000 (17:13 +0000)]
Rename windows-termcap.c -> stub-termcap.c
Preparation for using this on all hosts.
Confirmed that --host=x86_64-w64-mingw32 still builds the stub
termcap.
gdb/ChangeLog:
2015-02-26 Pedro Alves <palves@redhat.com>
* windows-termcap.c: Rename to ...
* stub-termcap.c: ... this. Adjust header line.
* Makefile.in (SFILES): Refer to stub-termcap.c instead of
windows-termcap.c.
* configure: Regenerate.
* configure.ac: Refer to stub-termcap.o instead of
windows-termcap.o.
* gdb_curses.h: Mention stub-termcap.c instead of
windows-termcap.c.
Jan Kratochvil [Thu, 26 Feb 2015 16:40:57 +0000 (17:40 +0100)]
compile: Fix GNU-IFUNC funcs called from injected code
One could not call IFUNCs (=indirect functions) from the compiled injected
code. Either it errored with:
gdb command line:1:1: error: function return type cannot be function
or it just called the IFUNC dispatcher in normal way, returning real function
implementation address instead of the function return value (and thus no
function was called).
gdb/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile-c-symbols.c (convert_one_symbol, convert_symbol_bmsym)
(gcc_symbol_address): Call gnu_ifunc_resolve_addr.
gdb/testsuite/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.compile/compile-ifunc.c: New file.
* gdb.compile/compile-ifunc.exp: New file.
Antoine Tremblay [Wed, 25 Feb 2015 16:00:01 +0000 (11:00 -0500)]
Fix print of value type in a corner case of finish
When doing finish in a function, if gdb fails to return a value, gdb
also fails at printing the value type if this type is a struct.
For example :
(gdb) fin
....
Value returned has type: . Cannot determine contents
This patch fixes this by calling type_to_string to print the type
so that we can support these types.
This patch returns the following example output :
(gdb) fin
....
Value returned has type: struct test. Cannot determine contents
Also, this patch modifies structs.exp to check that we return the
correct type.
gdb/ChangeLog:
* gdb/infcmd.c (print_return_value): use type_to_string to print type.
gdb/testsuite/ChangeLog:
* gdb.base/structs.exp: Check for correct struct on finish.
Nick Clifton [Thu, 26 Feb 2015 14:21:54 +0000 (14:21 +0000)]
Fix undefined arithmetic operations detected by -fsanitize=undefined when running readelf on fuzzed binaries.
PR binutils/17512
* dwarf.c (display_debug_loc): Pacify the undefined behaviour
sanitizer by simplifying address difference calculation.
(struct Frame_Chunk): Change type of cfa_offset to dwarf_vma in
order to avoid arithmetic overflows.
(frame_display_row): Cast cfa_offset before printing it.
(display_debug_frames): Likewise.
Check for an unexpected segment size.
Chnage type of 'l' local to dwarf_vma and cast it back to an int
when printing.
(process_cu_tu_index): Tighten check for an invalid ncols value.
* readelf.c (process_corefile_note_segment): Check for
inote.descdata extending beyond the end of the section.
(process_v850_notes): Likewise.
Yao Qi [Thu, 26 Feb 2015 14:21:19 +0000 (14:21 +0000)]
Dwarf assembler: handle one instruction function
On aarch64, we got the following fail:
(gdb) disassemble func
Dump of assembler code for function func:
0x0000000000400730 <+0>: ret
End of assembler dump.^M
(gdb) x/2i func+0^M
0x400730 <func>: ret^M
0x400734 <main>: stp x29, x30, [sp,#-16]!^M
(gdb) FAIL: gdb.dwarf2/dw2-ifort-parameter.exp: x/2i func+0
the pattern in proc function_range expects to match <func+0>, however,
GDB doesn't display the offset when it is zero. This patch is to
adjust the pattern when $func_length is zero.
gdb/testsuite:
2015-02-26 Yao Qi <yao.qi@linaro.org>
* lib/dwarf.exp (function_range): Adjust pattern when $func_length
is zero.
Jan Kratochvil [Thu, 26 Feb 2015 13:08:01 +0000 (14:08 +0100)]
SEGV in ppc64_elf_get_synthetic_symtab reading a separate debug file
The attached patch fixes the SEGV and lets GDB successfully
load all kernel modules installed by default on RHEL 7.
Valgrind on F-21 x86_64 host has shown me more clear what is the problem:
Reading symbols from /home/jkratoch/t/cordic.ko...Reading symbols from
/home/jkratoch/t/cordic.ko.debug...=================================================================
==22763==ERROR: AddressSanitizer: heap-use-after-free on address 0x6120000461c8 at pc 0x150cdbd bp 0x7fffffffc7e0 sp 0x7fffffffc7d0
READ of size 8 at 0x6120000461c8 thread T0
#0 0x150cdbc in ppc64_elf_get_synthetic_symtab /home/jkratoch/redhat/gdb-test-asan/bfd/elf64-ppc.c:3282
#1 0x8c5274 in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1205
#2 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
0x6120000461c8 is located 264 bytes inside of 288-byte region [0x6120000460c0,0x6120000461e0)
freed by thread T0 here:
#0 0x7ffff715454f in __interceptor_free (/lib64/libasan.so.1+0x5754f)
#1 0xde9cde in xfree common/common-utils.c:98
#2 0x9a04f7 in do_my_cleanups common/cleanups.c:155
#3 0x9a05d3 in do_cleanups common/cleanups.c:177
#4 0x8c538a in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1229
#5 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
previously allocated by thread T0 here:
#0 0x7ffff71547c7 in malloc (/lib64/libasan.so.1+0x577c7)
#1 0xde9b95 in xmalloc common/common-utils.c:41
#2 0x8c4da2 in elf_read_minimal_symbols /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1147
#3 0x8c55e7 in elf_symfile_read /home/jkratoch/redhat/gdb-test-asan/gdb/elfread.c:1268
[...]
SUMMARY: AddressSanitizer: heap-use-after-free /home/jkratoch/redhat/gdb-test-asan/bfd/elf64-ppc.c:3282 ppc64_elf_get_synthetic_symtab
[...]
==22763==ABORTING
A similar case a few lines later I have fixed in 2010 by:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
3f1eff0a2c7f0e7078f011f55b8e7f710aae0cc2
My testcase does not always reproduce it but at least a bit:
* GDB without ppc64 target (even as a secondary one) is reported as "untested"
* ASAN-built GDB with ppc64 target always crashes (and PASSes with this fix)
* unpatched non-ASAN-built GDB with ppc64 target crashes from commandline
* unpatched non-ASAN-built GDB with ppc64 target PASSes from runtest (?)
gdb/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfread.c (elf_read_minimal_symbols): Use bfd_alloc for
bfd_canonicalize_symtab.
gdb/testsuite/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/cordic.ko.bz2: New file.
* gdb.arch/cordic.ko.debug.bz2: New file.
* gdb.arch/ppc64-symtab-cordic.exp: New file.
Nick Clifton [Thu, 26 Feb 2015 12:23:18 +0000 (12:23 +0000)]
Fixes a resource exhaustion problem when running windres on a corrupt binary.
PR binutils/17512
* resrc.c (write_rc_messagetable): Tighten check for invalid
message lengths.
Alan Modra [Thu, 26 Feb 2015 10:56:42 +0000 (21:26 +1030)]
PowerPC64 thread-safe stubs not needed for iplt
I was looking at a current glibc using objdump today and saw an odd
plt call stub.
0000000000044d80 <
00000033.plt_call.__strchrnul>:
44d80: f8 41 00 28 std r2,40(r1)
44d84: e9 82 8c f8 ld r12,-29448(r2)
44d88: 7d 89 03 a6 mtctr r12
44d8c: e8 42 8d 00 ld r2,-29440(r2)
44d90: 28 22 00 00 cmpldi r2,0
44d94: 4c e2 04 20 bnectr+
44d98: 48 13 84 f0 b 17d288 <realloc@plt>
What? It doesn't branch to __strchrnul@plt on finding a zero r2?
Turns out this isn't a real problem since the stub is for loading an
ifunc, so will not be lazily resolved and thus r2 will never be zero.
Of course, that means the thread-safety check is unnecessary.
I also tweak the special __tls_get_addr_opt call stub here, to
restore r2 immediately after the call. Not doing that might affect
eh_frame unwinding.
* elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build
thread-safe stubs for iplt.
(build_tls_get_addr_stub): Restore r2 immediately after call.
John Baldwin [Wed, 25 Feb 2015 14:51:42 +0000 (09:51 -0500)]
Rework signal frame probing for FreeBSD/x86
- Use signal frame sniffers that look for the signal trampoline
instruction sequence to detect most signal frames.
- FreeBSD kernels between 9.2 and 10.1 inclusive do not include the
signal trampoline code in process core dumps. To detect signal
frames for core dumps under these kernels, use the
kern.proc.sigtramp.<pid> sysctl to fetch the location of the signal
trampoline in the gdb process and assume that PC values within this
location are signal frames. This depends on that location being
identical for all binaries.
gdb/ChangeLog:
2015-02-25 John Baldwin <jhb@FreeBSD.org>
* amd64fbsd-nat.c: Include sys/user.h.
(_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP sysctl
instead of KERN_PS_STRINGS to locate the signal trampoline.
* i386fbsd-nat.c: Include sys/user.h.
(_initialize_i386fbsd_nat): Use the KERN_PROC_SIGTRAMP sysctl
instead of KERN_PS_STRINGS to locate the signal trampoline.
* amd64fbsd-tdep.c (amd64fbsd_sigtramp_code): New.
(amd64fbsd_sigtramp_p): New.
(amd64fbsd_sigtramp_start_addr, amd64fbsd_sigtramp_end_addr): No
longer set default values.
(amd64fbsd_init_abi): Set "sigtramp_p" to "amd64fbsd_sigtramp_p".
* i386fbsd-tdep.c (i386fbsd_sigtramp_start)
(i386fbsd_sigtramp_middle, i386fbsd_sigtramp_end)
(i386fbsd_freebsd4_sigtramp_start)
(i386fbsd_freebsd4_sigtramp_middle)
(i386fbsd_freebsd4_sigtramp_end, i386fbsd_osigtramp_start)
(i386fbsd_osigtramp_middle, i386fbsd_osigtramp_end): New.
(i386fbsd_sigtramp_p): New.
(i386fbsd_sigtramp_start_addr, i386fbsd_sigtramp_end_addr): No
longer set default values.
(i386fbsd_init_abi): Set "sigtramp_p" to "i386fbsd_sigtramp_p".
John Baldwin [Thu, 26 Feb 2015 11:07:57 +0000 (11:07 +0000)]
Fix infinite recursion in amd64fbsd_sigcontext_addr
amd64fbsd_sigcontext_addr is using frame_unwind_register_unsigned to
fetch the stack pointer which results in infinite recursion. This
patch changes it to use get_frame_register to match the
sigcontext_addr methods in the i386-bsd and amd64-linux targets
instead.
gdb/ChangeLog:
2015-02-25 John Baldwin <jhb@freebsd.org>
* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use
get_frame_register instead of frame_unwind_register_unsigned.
Jan Kratochvil [Thu, 26 Feb 2015 10:50:08 +0000 (11:50 +0100)]
Change // comment in gdb/compile/
Missing ChangeLog in the previous commit:
bb2b33b9395662e7562be34b47b9533620b583c6
gdb/ChangeLog
2015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
PR build/18033
* compile/compile-c-support.c (c_compute_program): Change // comment.
* compile/compile-object-load.c (setup_sections): Change // comment.
Jan Kratochvil [Thu, 26 Feb 2015 10:48:18 +0000 (11:48 +0100)]
Change // comment in gdb/compile/
Joel Brobecker [Thu, 26 Feb 2015 09:42:04 +0000 (10:42 +0100)]
Remove // comment in gdb/iq2000-tdep.c
gdb/ChangeLog:
PR build/18033:
* iq2000-tdep.c (iq2000_frame_cache): Delete C++-style comment.
Terry Guo [Thu, 26 Feb 2015 06:11:41 +0000 (14:11 +0800)]
[ARM]Update for Tag_ABI_HardFP_use per EABI doc
Updated how we merge and display this attribute per the latest
EABI documents.
bfd/ChangeLog
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Update how we
merge Tag_ABI_HardFP_use.
binutils/ChangeLog
* readelf.c (arm_attr_tag_ABI_HardFP_use): Update how we
display it.
ld/testsuite/ChangeLog
* ld-arm/attr-merge-3.attr: Remove Tag_ABI_HardFP_use.
* ld-arm/attr-merge-vfp-10.d: Likewise.
* ld-arm/attr-merge-vfp-10r.d: Likewise.
* ld-arm/attr-merge-vfp-12.d: Likewise.
* ld-arm/attr-merge-vfp-12r.d: Likewise.
* ld-arm/attr-merge-vfp-13.d: Likewise.
* ld-arm/attr-merge-vfp-13r.d: Likewise.
* ld-arm/attr-merge-vfp-14.d: Likewise.
* ld-arm/attr-merge-vfp-14r.d: Likewise.
* ld-arm/attr-merge-vfp-6.d: Likewise.
* ld-arm/attr-merge-vfp-6r.d: Likewise.
* ld-arm/attr-merge-vfp-7.d: Likewise.
* ld-arm/attr-merge-vfp-7r.d: Likewise.
* ld-arm/attr-merge-vfp-8.d: Likewise.
* ld-arm/attr-merge-vfp-8r.d: Likewise.
Alan Modra [Mon, 23 Feb 2015 06:15:05 +0000 (16:45 +1030)]
Use dynamic text relocs for protected vars
Rather than reporting a link error on attempting to use dynbss for
protected vars, use dynamic text relocs.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
Use text relocs rather than giving an error on trying to use
.dynbss for protected shared lib vars.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
GDB Administrator [Thu, 26 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 20 Feb 2015 20:12:56 +0000 (20:12 +0000)]
objcopy: Factor out some of the option parsing code.
This patch splits out some of the option parsing code, increasing code
reuse.
binutils/ChangeLog:
* objcopy.c (init_section_add): New function.
(section_add_load_file): New function.
(copy_main): Make use of new functions.
Andrew Burgess [Thu, 8 Jan 2015 22:07:48 +0000 (22:07 +0000)]
AVR/ld: Use .avr.prop data during linker relaxation.
Make use of the data held within the .avr.prop section during linker
relaxation in order to maintain the properties of the .org and .align
directives.
In relation to the .align directives, if enough bytes are deleted before
a .align directive then the alignment can be moved while still
maintaining the alignment requirement.
bfd/ChangeLog:
* elf32-avr.c (struct elf_avr_section_data): New structure.
(struct avr_relax_info): New structure.
(elf_avr_new_section_hook): New function.
(struct elf_avr_section_data): Add relax_info.
(get_avr_relax_info): New function.
(init_avr_relax_info): New function.
(elf32_avr_relax_delete_bytes): Find next property record before
deleting bytes. When deleting don't move bytes beyond the next
property record.
(avr_elf32_assign_records_to_section): New function.
(avr_property_record_compare): New function.
(avr_load_all_property_sections): New function.
(elf32_avr_relax_section): Load property data. After relaxing the
section, move any .align directives that have enough deleted bytes
before them.
(bfd_elf32_new_section_hook): Define.
ld/testsuite/ChangeLog:
* ld-avr/avr-prop-1.d: New file.
* ld-avr/avr-prop-1.s: New file.
* ld-avr/avr-prop-2.d: New file.
* ld-avr/avr-prop-2.s: New file.
* ld-avr/avr-prop-3.d: New file.
* ld-avr/avr-prop-3.s: New file.
* ld-avr/avr-prop-4.d: New file.
* ld-avr/avr-prop-4.s: New file.
Andrew Burgess [Thu, 8 Jan 2015 21:55:43 +0000 (21:55 +0000)]
avr/objdump: Support dumping .avr.prop section.
Add support to objdump for dumping the .avr.prop section in a structured
way.
binutils/ChangeLog:
* od-elf32_avr.c: Add elf32-avr.h include.
(OPT_AVRPROP): Define.
(options[]): Add 'avr-prop' entry.
(elf32_avr_help): Add avr-prop help text.
(elf32_avr_dump_avr_prop): New function.
(elf32_avr_dump): Add check for avr-prop.
bfd/ChangeLog:
* elf32-avr.h (struct avr_property_header): New strucure.
(avr_elf32_load_property_records): Declare.
(avr_elf32_property_record_name): Declare.
* elf32-avr.c: Add bfd_stdint.h include.
(retrieve_local_syms): New function.
(get_elf_r_symndx_section): New function.
(get_elf_r_symndx_offset): New function.
(internal_reloc_compare): New function.
(struct avr_find_section_data): New structure.
(avr_is_section_for_address): New function.
(avr_find_section_for_address): New function.
(avr_elf32_load_records_from_section): New function.
(avr_elf32_load_property_records): New function.
(avr_elf32_property_record_name): New function.
gas/testsuite/ChangeLog:
* gas/avr/avr-prop-1.d: New file.
* gas/avr/avr-prop-1.s: New file.
Andrew Burgess [Thu, 8 Jan 2015 20:55:10 +0000 (20:55 +0000)]
avr/gas: Write out data to track .org/.align usage.
Adds support to the assembler to write out data for tracking the use of
.org and .align directives. This data is collected within the assembler
and written out to a section ".avr.prop" (if there's anything to write
out).
This patch does not add any tests. The next patch in this series will
add a better mechanism for visualising the contents of .avr.prop which
will make writing tests much easier.
This patch also does not make any use of this collected data, that will
also come along in a later patch; the intended consumer is the linker,
during linker relaxation this information will be used to ensure that
the .org and .align directives are honoured.
bfd/ChangeLog:
* elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define.
(AVR_PROPERTY_RECORDS_VERSION): Define.
(AVR_PROPERTY_SECTION_HEADER_SIZE): Define.
(struct avr_property_record): New structure.
gas/ChangeLog:
* config/tc-avr.c: Add elf32-avr.h include.
(struct avr_property_record_link): New structure.
(avr_output_property_section_header): New function.
(avr_record_size): New function.
(avr_output_property_record): New function.
(avr_create_property_section): New function.
(avr_handle_align): New function.
(exclude_section_from_property_tables): New function.
(create_record_for_frag): New function.
(append_records_for_section): New function.
(avr_create_and_fill_property_section): New function.
(avr_post_relax_hook): New function.
* config/tc-avr.h (md_post_relax_hook): Define.
(avr_post_relax_hook): Declare.
(HANDLE_ALIGN): Define.
(avr_handle_align): Declare.
(strut avr_frag_data): New structure.
(TC_FRAG_TYPE): Define.
Oleg Endo [Wed, 25 Feb 2015 20:22:54 +0000 (21:22 +0100)]
[SH] Fix clrs, sets, pref insn arch memberships.
opcodes/
* sh-opc.h (clrs, sets): Mark as arch_sh3_nommu_up instead of
arch_sh_up.
(pref): Mark as arch_sh2a_nofpu_or_sh3_nommu_up instead of
arch_sh2a_nofpu_or_sh4_nommu_nofpu_up.
gas/testsuite/
* gas/sh/arch/arch.exp: Replace dead code to generate expected .s files
with ...
* gas/sh/arch/sh-opc-gen-as.pl: ... this new script.
* gas/sh/arch/arch_expected.txt: Regenerate.
* gas/sh/arch/sh-dsp.s: Likewise.
* gas/sh/arch/sh-opc-gen-as.pl: Likewise.
* gas/sh/arch/sh.s: Likewise.
* gas/sh/arch/sh2.s: Likewise.
* gas/sh/arch/sh2a-nofpu-or-sh3-nommu.s: Likewise.
* gas/sh/arch/sh2a-nofpu-or-sh4-nommu-nofpu.s: Likewise.
* gas/sh/arch/sh2a-nofpu.s: Likewise.
* gas/sh/arch/sh2a-or-sh3e.s: Likewise.
* gas/sh/arch/sh2a-or-sh4.s: Likewise.
* gas/sh/arch/sh2a.s: Likewise.
* gas/sh/arch/sh2e.s: Likewise.
* gas/sh/arch/sh3-dsp.s: Likewise.
* gas/sh/arch/sh3-nommu.s: Likewise.
* gas/sh/arch/sh3.s: Likewise.
* gas/sh/arch/sh3e.s: Likewise.
* gas/sh/arch/sh4-nofpu.s: Likewise.
* gas/sh/arch/sh4-nommu-nofpu.s: Likewise.
* gas/sh/arch/sh4.s: Likewise.
* gas/sh/arch/sh4a-nofpu.s: Likewise.
* gas/sh/arch/sh4a.s: Likewise.
* gas/sh/arch/sh4al-dsp.s: Likewise.
ld/testsuite/
* ld-sh/arch/arch_expected.txt: Regenerate.
* ld-sh/arch/sh-dsp.s: Likewise.
* ld-sh/arch/sh.s: Likewise.
* ld-sh/arch/sh2.s: Likewise.
* ld-sh/arch/sh2a-nofpu-or-sh3-nommu.s: Likewise.
* ld-sh/arch/sh2a-nofpu-or-sh4-nommu-nofpu.s: Likewise.
* ld-sh/arch/sh2a-nofpu.s: Likewise.
* ld-sh/arch/sh2a-or-sh3e.s: Likewise.
* ld-sh/arch/sh2a-or-sh4.s: Likewise.
* ld-sh/arch/sh2a.s: Likewise.
* ld-sh/arch/sh2e.s: Likewise.
* ld-sh/arch/sh3-dsp.s: Likewise.
* ld-sh/arch/sh3-nommu.s: Likewise.
* ld-sh/arch/sh3.s: Likewise.
* ld-sh/arch/sh3e.s: Likewise.
* ld-sh/arch/sh4-nofpu.s: Likewise.
* ld-sh/arch/sh4-nommu-nofpu.s: Likewise.
* ld-sh/arch/sh4.s: Likewise.
* ld-sh/arch/sh4a-nofpu.s: Likewise.
* ld-sh/arch/sh4a.s: Likewise.
* ld-sh/arch/sh4al-dsp.s: Likewise.
Kyrylo Tkachov [Wed, 25 Feb 2015 13:40:08 +0000 (13:40 +0000)]
[gas][ARM] Document supported ARMv8 cores.
2015-02-25 Matthew Wahab <matthew.wahab@arm.com>
* doc/c-arm.texi (-mcpu=): Add cortex-a53, cortex-a57 and
cortex-a72.
Yao Qi [Wed, 25 Feb 2015 10:39:59 +0000 (10:39 +0000)]
[aarch64] Fix one fail in gdb.xml/tdesc-regs.exp
Hi,
I see the following fail in aarch64-linux-gnu testing...
(gdb) set tdesc file /XXX/gdb/testsuite/gdb.xml/single-reg.xml^M
warning: Architecture rejected target-supplied description^M
(gdb) FAIL: gdb.xml/tdesc-regs.exp: set tdesc file single-reg.xml
core-regs isn't set for aarch64 target, and looks it is an oversight
when aarch64 port was added.
gdb/testsuite:
2015-02-25 Yao Qi <yao.qi@linaro.org>
* gdb.xml/tdesc-regs.exp: Set core-regs to aarch64-core.xml for
aarch64*-*-* target.
GDB Administrator [Wed, 25 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Tue, 24 Feb 2015 17:58:50 +0000 (17:58 +0000)]
Adds support for emulating V850 e3v5 instructions to the simulator.
* v850.igen: Add more e3v5 support.
(FMAF.S): New pattern.
(FMSF.S): New pattern.
(FNMAF.S): New pattern.
(FNMSF.S): New pattern.
(cnvq15q30): New pattern.
(cnvq30q15): New pattern.
(cnvq31q62): New pattern.
(cnvq62q31): New pattern.
(dup.h): New pattern.
(dup.w): New pattern.
(expq31): New pattern.
(modadd): New pattern.
(mov.dw): New pattern.
(mov.h): New pattern.
(mov.w): New pattern.
(pki16i32): New pattern.
(pki16ui8): New pattern.
(pki32i16): New pattern.
(pki64i32): New pattern.
(pkq15q31): New pattern.
(pkq30q31): New pattern.
(pkq31q15): New pattern.
(pkui8i16): New pattern.
(vabs.h): New pattern.
(vabs.w): New pattern.
(vadd.dw): New placeholder pattern.
(vadd.h): New placeholder pattern.
(vadd.w): New placeholder pattern.
(vadds.h): New placeholder pattern.
(vadds.w): New placeholder pattern.
(vaddsat.h): New placeholder pattern.
(vaddsat.w): New placeholder pattern.
(vand): New pattern.
(vbiq.h): New placeholder pattern.
(vbswap.dw): New placeholder pattern.
(vbswap.h): New placeholder pattern.
(vbswap.w): New placeholder pattern.
(vcalc.h): New placeholder pattern.
(vcalc.w): New placeholder pattern.
(vcmov): New placeholder pattern.
Nick Clifton [Tue, 24 Feb 2015 17:54:09 +0000 (17:54 +0000)]
Adds support for generating notes in V850 binaries.
bfd * elf32-v850.c (v850_set_note): New function. Creates a Renesas
style note entry.
(v850_elf_make_note_section): New function. Creates a note
section.
(v850_elf_create_sections): New function. Create a note section
if one is not already present.
(v850_elf_set_note): New function. Adds a note to a bfd.
(v850_elf_copy_private_bfd_data): New function. Copies V850
notes.
(v850_elf_merge_notes): New function. Merges V850 notes.
(print_v850_note): New function. Displays a V850 note.
(v850_elf_print_notes): New function. Displays all notes attached
to a bfd.
(v850_elf_merge_private_bfd_data): Call v850_elf_merge_notes.
(v850_elf_print_private_bfd_data): Call v850_elf_print_notes.
(v850_elf_fake_sections): Set the type of the V850 note section.
* bfd-in.h (v850_elf_create_sections): Add prototype.
(v850_elf_set_note): Add prototype.
* bfd-in2.h: Regenerate.
binutils* readelf.c (get_machine_flags): Remove deprecated V850 machine
flags.
(get_v850_section_type_name): New function. Handles V850 special
sections.
(get_section_type_name): Add support for V850.
(get_v850_elf_note_type): New function. Returns the name of a
V850 note.
(print_v850_note): New function. Prints a V850 note.
(process_v850_notes): New function. Prints V850 notes.
(process_note_sections): Add support for V850.
binutils/testsute
* binutils-all/objcopy.exp: Skip the strip-10 test for the V850.
gas * config/tc-v850.c (soft_float): New variable.
(v850_data_8): New variable.
(md_show_usage): Add -msoft-float/-mhard-float.
(md_parse_option): Likewise.
(md_begin): Set the default value of soft_float.
(v850_md_end): New function. Creates a note section.
* config/tc-v850.h (md_end): Define.
* doc/c-v850.texi: Document -msoft-float/-mhard-float.
gas/testsuite
* gas/elf/elf.exp: Add special version of the section2 test for
the V850.
* gas/elf/section2.e-v850: New file.
include/elf
* v850.h (EF_RH850_SIMD): Delete deprecated flag.
(EF_RH850_CACHE): Likewise.
(EF_RH850_MMU): Likewise.
(EF_RH850_DATA_ALIGN8): Likewise.
(SHT_RENESAS_IOP): Fix typo in name.
(SHT_RENESAS_INFO): Define.
(V850_NOTE_SECNAME): Define.
(SIZEOF_V850_NOTE): Define.
(V850_NOTE_NAME): Define.
(enum v850_notes): New enum.
(NUM_V850_NOTES): Define.
ld/ChangeLog
2015-02-24 Nick Clifton <nickc@redhat.com>
* Makefile.am (ev850.c): Add dependency upon
$(srcdir)/emultempl/v850elf.em.
(ev850_rh850.c): Likewise.
* Makefile.in: Regenerate.
* emultempl/v850elf.em: New file.
* emulparams/v850.sh (EXTRA_EM_FILE): Define.
* emulparams/v850_rh850.sh (EXTRA_EM_FILE): Define.
* scripttempl/v850.sc: Add .note.renesas section.
* scripttempl/v850_rh850.sc: Likewise.
ld/testsuite
* ld-elf/extract-symbol-1sec.d: Expect to fail on the V850.
Nick Clifton [Tue, 24 Feb 2015 17:01:23 +0000 (17:01 +0000)]
Fixes compiling peXXigen under MAC OS/X where the wcsncasecmp function is not available.
* configure.ac (AC_CHECK_HEADERS): Add wctype.h.
* configure: Regenerate.
* config.in: Regenerate.
* peXXigen.c: Include wctype.h if HAVE_WCTYPE_H is defined.
(u16_mbtowc): Use wint_t types if HAVE_WCTYPE_H is defined.
(rsrc_cmp): Use towlower instead of wcsncasecmp if HAVE_WCTYPE_H
is defined.
Mike Frysinger [Tue, 24 Feb 2015 06:47:51 +0000 (01:47 -0500)]
readelf: handle corrupted chains better
The current chain walker tries to protect itself against loops, by only
works with loops of length 1: a chain that points to itself. If you have
a chain longer than that (3->4->3->4->...), readelf will still hang.
Since we know the max length of the chain, simply abort when we've walked
more times than that. The only way that could have happened is if there
was a loop.
Alan Modra [Tue, 24 Feb 2015 12:34:20 +0000 (23:04 +1030)]
Add aligned string merge test
* ld-elf/merge3.s, * ld-elf/merge3.d: New test.
Dmitry Antipov [Tue, 24 Feb 2015 13:21:10 +0000 (13:21 +0000)]
Speed up the display of unwind tables by using a binary chop search to locate function symbols.
* readelf.c (find_symbol_for_address): Use a binary search to
speed up symbol location. Skip check for function symbol type.
(*_unw_aux_info): Add funtab and nfuns fields contains a sorted
list of function symbols.
(dump_ia64_unwind): Initialise the funtab and nfuns fields and
pass them to find_symbol_for_address.
(dump_hppa_unwind): Likewise.
(arm_print_vma_and_name): Pass funtab to find_symbol_for_address.
(dump_arm_unwind): Initialise the funtab and nfuns fields.
Senthil Kumar Selvaraj [Tue, 24 Feb 2015 11:26:28 +0000 (11:26 +0000)]
This patch modifies the AVR linker script templates to use __<name>_REGION_LENGTH__ symbols, if provided, for setting memory region lengths, defaulting to the current constant values otherwise.
ld * scripttempl/avr.sc: Add new user_signatures region. Define and Use
symbols for all region lengths.
* scripttempl/avrtiny.sc: Define and use symbols for all region lengths.
testsuite * ld-avr/region_overflow.d: New test.
* ld-avr/region_overflow.s: Likewise.
Nick Clifton [Tue, 24 Feb 2015 11:10:07 +0000 (11:10 +0000)]
Improves the warning message produyced by objdump when it cannot load a section.
* objdump.c (dump_section): Extend the warning message displayed
when a section cannot be loaded.
Nick Clifton [Tue, 24 Feb 2015 10:27:07 +0000 (10:27 +0000)]
Fix the detection of illegal memory accesses in the MSP430 simulator.
* msp430-sim.c (sim_open): Allocate memory regions matching those
declared in the libgloss/msp430 linker scripts.
Allow sim_load_file to fail.
(get_op): Test the correct address bit when checking for out of
range addresses.
Include the address in the error message when an illegal access to
the hardware multiplier is detected.
(put_op): Test the correct address bit when checking for out of
range addresses.
Nick Clifton [Tue, 24 Feb 2015 10:13:51 +0000 (10:13 +0000)]
Fix the gas test align2 for the PDP11 by ensuring that the .text and .data sections are written to their aligned sizes.
* pdp11.c (set_section_contents): Pad the .text and .data sections
to their aligned sizes.
Alan Modra [Tue, 24 Feb 2015 07:46:26 +0000 (18:16 +1030)]
PowerPC64 GOLD: complain on misaligned _DS relocs
PR 18010
* powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
complain if value is not a multiple of four.
(Target_powerpc::Relocate::relocate): Correct handling of
R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
GDB Administrator [Tue, 24 Feb 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Mon, 23 Feb 2015 21:39:45 +0000 (13:39 -0800)]
Fix typo in earlier entry.
Sergio Durigan Junior [Mon, 23 Feb 2015 21:15:29 +0000 (16:15 -0500)]
PR gdb/18008: Fix typo in documentation
This obvious patch fixes a typo in our documentation
(s/problam/problem).
gdb/doc/ChangeLog:
2015-02-23 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/18008
* gdb.texinfo (maint internal-error, maint internal-warning, maint
demangler-warning): Fix typo ("problam").
Pedro Alves [Mon, 23 Feb 2015 18:59:38 +0000 (18:59 +0000)]
gdbserver: redo stepping over breakpoint that was on top of a permanent breakpoint
I'm going to add an alternate mechanism of breakpoint trap
identification to 'check_stopped_by_breakpoint' that does not rely on
checking the instruction at PC. The mechanism currently used to tell
whether we're stepping over a permanent breakpoint doesn't fit in that
new method. This patch redoes the whole logic in a different way that
works with both old and new methods, in essence moving the "stepped
permanent breakpoint" detection "one level up". It makes lower level
check_stopped_by_breakpoint always the adjust the PC, and then has
linux_wait_1 advance the PC past the breakpoint if necessary. This
ends up being better also because this now handles
non-decr_pc_after_break targets too. Before, such targets would get
stuck forever reexecuting the breakpoint instruction.
Tested on x86_64 Fedora 20.
gdb/gdbserver/ChangeLog:
2015-02-23 Pedro Alves <palves@redhat.com>
* linux-low.c (check_stopped_by_breakpoint): Don't check if the
thread was doing a step-over; always adjust the PC if
we stepped over a permanent breakpoint.
(linux_wait_1): If we stepped over breakpoint that was on top of a
permanent breakpoint, manually advance the PC past it.
Pedro Alves [Mon, 23 Feb 2015 17:35:09 +0000 (17:35 +0000)]
delete_breakpoints: Rewrite using gdb_test_multiple
Because delete_breakpoints uses gdb_expect directly, an internal error
results in slow timeouts instead of quickly bailing out. This patch
rewrites the procedure to use gdb_test_multiple instead, while
preserving the existing general logic ("delete breakpoints" + "info
breakpoints").
gdb/testsuite/
2015-02-23 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (delete_breakpoints): Rewrite using
gdb_test_multiple.
Vinay [Mon, 23 Feb 2015 17:16:30 +0000 (17:16 +0000)]
Adds a space between the operands of the RL78's MOV instruction for consistency with the disassembling of other instructions.
* rl78-decode.opc (MOV): Added space between two operands for
'mov' instruction in index addressing mode.
* rl78-decode.c: Regenerate.
Yoshinori Sato [Mon, 23 Feb 2015 17:04:53 +0000 (17:04 +0000)]
Add support for the h8300-linux target.
ld * Makefile.am: (ALL_EMULATION_SOURCES): Add new emulations.
* Makefile.in: Regenerate.
* configure.tgt: Add h8300-*-linux
* emulparams/h8300elf_linux.sh: Add new emulation.
* emulparams/h8300helf_linux.sh: Likewise.
* emulparams/h8300self_linux.sh: Likewise.
* emulparams/h8300sxelf_linux.sh: Likewise.
bfd * config.bfd: Add h8300-*-linux.
* configure.ac: Add h8300_elf32_linux_vec.
* configure: Regenerate.
* elf32-h8300.c: Likewise.
* targets.c(_bfd_target_vector): Likewise.
gas * config/tc-h8300.c (line_separater_chars): Add a version for
h8300-linux that includes a separator.
(default_mach): New variable.
(md_main): Use it.
(md_longopts): Add '--march' option.
(md_parse_option): Parse the new option.
* config/tc-h8300.h (TARGET_FORMAT): Add elf32-h8300-linux.
* configure.tgt: Add h8300-*-linux
* doc/c-h8300.texi: Document --march.
Pedro Alves [Mon, 23 Feb 2015 16:45:39 +0000 (16:45 +0000)]
remote.c: simplify parsing stop reasons in T stop replies
We need to be careful with parsing optional stop reasons that start
with an hex character ("awatch", "core"), as GDBs that aren't aware of
them parse them as real numbers. That's silly of course, given that
there should be a colon after those magic "numbers". So if strtol on
"abbz:" doesn't return "first invalid char" pointing to the colon, we
know that "abbz" isn't really a register number. It must be optional
stop info we don't know about. This adjusts GDB to work that way,
removing the need for the special casing done upfront:
/* If this packet is an awatch packet, don't parse the 'a'
as a register number. */
if (strncmp (p, "awatch", strlen("awatch")) != 0
&& strncmp (p, "core", strlen ("core") != 0))
For as long as we care about compatibility with GDB 7.9, we'll need to
continue to be careful about this, so I added a comment.
Tested on x86_64 Fedora 20, native gdbserver.
gdb/ChangeLog:
2015-02-23 Pedro Alves <palves@redhat.com>
* remote.c (skip_to_semicolon): New function.
(remote_parse_stop_reply) <T stop reply>: Use it. Don't
special case the stop reasons that look like hex numbers
upfront. Instead handle real register numbers after matching
all the known stop reasons.
Nick Clifton [Mon, 23 Feb 2015 15:33:56 +0000 (15:33 +0000)]
Fixes a problem where "ld -ixxx" would report an error of "ld: bad -rpath option".
* lexsup.c (parse_args): Produce a more reasonable error message
when -ixxx or -rxxx is the last option on the linker command line.
Nick Clifton [Mon, 23 Feb 2015 14:53:02 +0000 (14:53 +0000)]
Fixes the generation of dwarf line debug information for the msp430, even in the presence of function sections and linker garbage collection.
PR 17940
* dwarf2dbg.c (out_header): When generating dwarf sections use
real symbols not temps for the start and end symbols.
* config/tc-msp430.h (TC_FORCE_RELOCATION_SUB_SAME): Also prevent
adjustments to relocations in debug sections.
(TC_LINKRELAX_FIXUP): Likewise.
* elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust debug
symbols at end of sections. Adjust function sizes.
Nick Clifton [Mon, 23 Feb 2015 13:43:11 +0000 (13:43 +0000)]
Fixes a typo in the license notice in include/elf/score.h
PR 17915
* score.h: Fix typo in license header.
Pedro Alves [Mon, 23 Feb 2015 14:03:48 +0000 (14:03 +0000)]
gdb.base/info-os.c: Include stdlib.h
Fixes:
> gdb compile failed, /gdb/testsuite/gdb.base/info-os.c: In function 'main':
> /gdb/testsuite/gdb.base/info-os.c:65:3: warning: implicit declaration of function 'atexit' [-Wimplicit-function-declaration]
> atexit (ipc_cleanup);
> ^
> FAIL: gdb.base/info-os.exp: cannot compile test program
with recent GCCs.
gdb/testsuite/ChangeLog:
2015-02-23 Pedro Alves <palves@redhat.com>
* gdb.base/info-os.c: Include stdlib.h.
Nick Clifton [Mon, 23 Feb 2015 13:39:51 +0000 (13:39 +0000)]
Fixes a couple of typos in the license header of the cpu-w65.c file.
PR 17914
* cpu-w65.c: Correct typos in license notice.