Pedro Alves [Wed, 12 Feb 2014 12:27:49 +0000 (12:27 +0000)]
H8/300: Fix gdb<->sim register mapping.
Currently, printing the H8/300 ccr register when debugging with the
sim is broken:
(gdb) target sim
...
(gdb) load
...
(gdb) start
...
Breakpoint 1, foo (i=0x0 <foo>) at main.c:4
4 {
(gdb) info registers ccr
Register 13 is not available
'13' is the ccr pseudo-register. This pseudo-register provides an
8-bit view into the raw ccr register (regno=8).
The problem is that the H8/300 port does not define a
register_sim_regno gdbarch hook, and thus when fetching the raw
register off of the sim, we end up in legacy_register_sim_regno trying
to figure out the sim register number for the raw CCR register:
int
legacy_register_sim_regno (struct gdbarch *gdbarch, int regnum)
{
/* Only makes sense to supply raw registers. */
gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch));
/* NOTE: cagney/2002-05-13: The old code did it this way and it is
suspected that some GDB/SIM combinations may rely on this
behavour. The default should be one2one_register_sim_regno
(below). */
if (gdbarch_register_name (gdbarch, regnum) != NULL
&& gdbarch_register_name (gdbarch, regnum)[0] != '\0')
return regnum;
else
return LEGACY_SIM_REGNO_IGNORE;
}
Because the raw ccr register does not have a name (so that it is
hidden from the user), that returns LEGACY_SIM_REGNO_IGNORE. That
means that we never actually read the value of the raw ccr register.
Before the <unavailable> support, this must have meant that ccr was
_always_ read as 0... At least, I'm not seeing how this ever worked.
The fix for that is adding a gdbarch_register_sim_regno hook that maps
all raw registers. Looking at sim/h8300/sim-main.h, I believe the
sim's register numbers are compatible with gdb's, so no actual
convertion is necessary.
gdb/
2014-02-12 Pedro Alves <palves@redhat.com>
* h8300-tdep.c (h8300_register_sim_regno): New function.
(h8300_gdbarch_init): Install h8300_register_sim_regno as
gdbarch_register_sim_regno hook.
Sanimir Agovic [Mon, 10 Feb 2014 17:54:15 +0000 (17:54 +0000)]
nios2-tdep: remove unreferenced global nios2_stub_frame_base
2014-02-12 Sanimir Agovic <sanimir.agovic@intel.com>
* nios2-tdep.c (nios2_stub_frame_base): Remove global.
Sanimir Agovic [Mon, 10 Feb 2014 18:00:01 +0000 (18:00 +0000)]
tic6x-tdep: set default frame base
2014-02-12 Sanimir Agovic <sanimir.agovic@intel.com>
* tic6x-tdep.c (tic6x_gdbarch_init): Call frame_base_set_default.
Alan Modra [Wed, 12 Feb 2014 10:34:32 +0000 (21:04 +1030)]
Fix bad interaction between --relax and tls optimisation
Adding long-branch stubs for __tls_get_addr calls that are optimised
away is silly. It also causes assertion failures on newer object files
that use R_PPC_TLSGD and R_PPC_TLSLD marker relocs, and half-optimised
(ie. broken) code for older object files.
PR 16546
* elf32-ppc.c (ppc_elf_relax_section): Don't build long-branch
stubs for calls to __tls_get_addr that we know will later be
optimised away.
Alan Modra [Wed, 12 Feb 2014 06:14:36 +0000 (16:44 +1030)]
Enable ppc476 workaround for ld -r.
The Linux kernel builds modules using ld -r. These might need the
ppc476 workaround, so enable it for ld -r if sections have sufficient
alignment to tell location within a page.
bfd/
* elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround
for ld -r, when code sections are sufficiently aligned.
* elf32-ppc.h (struct ppc_elf_params): Delete pagesize. Add
pagesize_p2.
ld/
* emultempl/ppc32elf.em (pagesize): New static var.
(ppc_after_open_output): Set params.pagesize_p2 from pagesize.
(PARSE_AND_LIST_ARGS_CASES): Adjust to use pagesize.
Alan Modra [Wed, 12 Feb 2014 10:38:01 +0000 (21:08 +1030)]
PR15530, mark symbol in executables if it matches dynamic_list
For powerpc64 as HJ did earlier for other ELF targets, and a tidy.
PR gold/15530
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
--export-dynamic and --dynamic-list marking of symbols.
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder
cheap tests first.
Mark Kettenis [Wed, 12 Feb 2014 11:08:28 +0000 (12:08 +0100)]
Add signal number conversions for OpenBSD.
gdb/ChangeLog:
* obsd-tdep.h (obsd_init_abi): New prototype.
* obsd-tdep.c: Define enum with OpenBSD signal numbers.
(obsd_gdb_signal_from_target, obsd_gdb_signal_to_target)
(obsd_init_abi): New functions.
* i386obsd-tdep.c: Include "obsd-tdep.h".
(i386obsd_init_abi): Call obsd_init_abi.
* amd64obsd-tdep.c: Include "obsd-tdep.h".
(amd64obsd_init_abi): Call obsd_init_abi.
* configure.tgt (i[34567]86-*-openbsd*, x86_64-*-openbsd*): Add
obsd-tdep.c to gdb_target_obs.
Doug Evans [Wed, 12 Feb 2014 07:19:22 +0000 (23:19 -0800)]
Remove stray parantheses for deffn.
Doug Evans [Tue, 11 Feb 2014 23:47:50 +0000 (15:47 -0800)]
* gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
of Tcl file commands.
Alan Modra [Tue, 11 Feb 2014 23:00:55 +0000 (09:30 +1030)]
daily update
Cary Coutant [Tue, 11 Feb 2014 19:33:49 +0000 (11:33 -0800)]
Fix readelf so it doesn't complain about corrupt attribute.
When a DW_FORM_flag_present attribute comes at the very end of a
debug section, readelf complains about a corrupt attribute
because it's checking to make sure there's at least one byte of
data remaining. This patch suppresses the check when the form
is DW_FORM_flag_present.
2014-02-11 Cary Coutant <ccoutant@google.com>
* binutils/dwarf.c (read_and_display_attr_value): Don't warn
for zero-length attribute value.
Cary Coutant [Tue, 11 Feb 2014 19:25:11 +0000 (11:25 -0800)]
Update ChangeLog from earlier patch.
Andrew Pinski [Fri, 7 Feb 2014 20:22:27 +0000 (12:22 -0800)]
2014-02-11 Andrew Pinski <apinski@cavium.com>
* emulparams/aarch64linux32.sh (LIBPATH_SUFFIX): Change to ilp32.
(ELF_INTERPRETER_NAME): Define.
* emulparams/aarch64linux32b.sh (ELF_INTERPRETER_NAME): Define.
Jose E. Marchesi [Tue, 11 Feb 2014 12:27:20 +0000 (04:27 -0800)]
Fix passing double float complex arguments in sparc64.
Double float complex objects are not 16-byte aligned in either
gcc or solaris studio. This patch makes gdb to not align double
float complex arguments in the dummy frame when calling a
function.
2014-02-11 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc64-tdep.c (sparc64_store_arguments): Do not align complex
double float arguments to 16-byte in the argument slots.
Doug Evans [Tue, 11 Feb 2014 07:04:38 +0000 (23:04 -0800)]
Don't crash if pkg-config is not found and guile wasn't explicitly requested.
* configure.ac: Don't crash if pkg-config is not found and guile
wasn't explicitly requested. Use AC_MSG_ERROR instead of AC_ERROR
in guile checks.
* configure: Regenerate.
Yao Qi [Thu, 30 Jan 2014 00:23:14 +0000 (08:23 +0800)]
Update comments to to_xfer_partial implementations.
Some comments to to_xfer_partial implementations are out of date.
This patch updates them using the "Implement the to_xfer_partial
target_ops method" pattern.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* aix-thread.c (aix_thread_xfer_partial): Update comments.
* auxv.c (procfs_xfer_auxv, memory_xfer_auxv): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partial): Likewise.
* gnu-nat.c (gnu_xfer_memory): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
Yao Qi [Mon, 27 Jan 2014 12:35:33 +0000 (20:35 +0800)]
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
Joel Brobecker [Tue, 11 Feb 2014 03:59:14 +0000 (07:59 +0400)]
Fix thinko in mi/mi-main.c::mi_cmd_data_write_memory_bytes comment.
gdb/ChangeLog:
2014-02-11 Simon Marchi <simon.marchi@ericsson.com> (tiny patch)
Checked in by Joel Brobecker <brobecker@adacore.com>.
* mi/mi-main.c (mi_cmd_data_write_memory_bytes): Fix comment.
Joel Brobecker [Tue, 11 Feb 2014 03:31:26 +0000 (07:31 +0400)]
Reformat symfile-debug.c::debug_qf_expand_symtabs_matching parameters.
gdb/ChangeLog:
* symfile-debug.c (debug_qf_expand_symtabs_matching): Reformat
function parameters.
Stan Shebs [Mon, 10 Feb 2014 23:01:14 +0000 (09:31 +1030)]
Add Doxygen support to GDB
Alan Modra [Mon, 10 Feb 2014 23:01:14 +0000 (09:31 +1030)]
daily update
Mark Kettenis [Mon, 10 Feb 2014 16:58:03 +0000 (17:58 +0100)]
Avoid killing all processes.
gdb/ChangeLog:
* gdb.threads/step-after-sr-lock.exp: Avoid executing
"kill -SIGUSR1 -1".
Will Newton [Mon, 16 Dec 2013 17:45:45 +0000 (17:45 +0000)]
gdb/elfread.c: Enable ifunc support on ARM.
There are two failures in the gnu-ifunc.exp test on ARM. These are
due to the failure to resolve the correct target function when
attempting to breakpoint a GNU ifunc resolved function:
(gdb) break gnu_ifunc
Breakpoint 4 at gnu-indirect-function resolver at 0x2aacb5a2
when gnu_ifunc has been resolved this should actually be:
(gdb) break gnu_ifunc
Breakpoint 4 at 0x868c
There are two reasons for this. The first is that ARM does not have a
separate .got.plt section so looking this up will always fail. The second
is that the Thumb bit needs to be stripped from the address to allow
it to be reliably compared when inserting into the ifunc cache.
Tested with no regressions on arm-linux-gnueabihf and
x86_64-unknown-linux-gnu.
gdb/ChangeLog:
2014-02-10 Will Newton <will.newton@linaro.org>
* elfread.c (elf_rel_plt_read): Look for a .got section if
looking up .got.plt fails.
(elf_gnu_ifunc_resolve_by_got): Call gdbarch_addr_bits_remove
on address passed to elf_gnu_ifunc_record_cache.
(elf_gnu_ifunc_resolve_addr): Likewise.
(elf_gnu_ifunc_resolver_return_stop): Likewise.
H.J. Lu [Thu, 6 Feb 2014 17:44:25 +0000 (09:44 -0800)]
Mark symbol in executables if it matches dynamic_list
bfd/
PR gold/16530
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in
executables if it matches dynamic_list.
ld/testsuite/
PR gold/16530
* ld-elf/dynamic-1.c: New file.
* ld-elf/dynamic-1.rd: Likewise.
* ld-elf/dynamic-1.syms: Likewise.
* ld-elf/shared.exp (build_tests): Add dynamic-1.
Rainer Orth [Mon, 10 Feb 2014 15:32:18 +0000 (16:32 +0100)]
Add PR reference.
Jose E. Marchesi [Mon, 10 Feb 2014 15:09:23 +0000 (07:09 -0800)]
Add gdbarch_in_function_epilogue_p hook for sparc64.
watchpoint_update and watchpoint_cond avoid checking for
watchpoints when we are located at a function epilogue in the
current frame. This is done in order to avoid using corrupted
local registers and unwinding a corrupted/destroyed stack.
The code determining whether we are in a function epilogue is
provided by the backends via the gdbarch_in_function_epilogue_p
hook. This commit adds such a hook for sparc64 targets.
2014-02-10 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-tdep.c (sparc_in_function_epilogue_p): New function.
(X_RETTURN): New macro.
* sparc-tdep.h: sparc_in_function_epilogue_p prototype.
* sparc64-tdep.c (sparc64_init_abi): Hook
sparc_in_function_epilogue_p.
Gary Benson [Mon, 10 Feb 2014 14:24:32 +0000 (14:24 +0000)]
Fix compile error
This commit fixes a compile error introduced by my previous commit.
Checked in as obvious.
2014-02-10 Gary Benson <gbenson@redhat.com>
* symfile-debug.c (debug_qf_expand_symtabs_matching):
Rename name_matcher to symbol_matcher.
Gary Benson [Mon, 10 Feb 2014 14:07:44 +0000 (14:07 +0000)]
Update debug_qf_expand_symtabs_matching to use typedefs.
Commit
206f2a5777679e6d1ad21ce435f6e7af92e2d41a added two new
typedefs, but did not update debug_qf_expand_symtabs_matching
to use them. This patch fixes this.
Checked in as obvious.
2014-02-10 Gary Benson <gbenson@redhat.com>
* symfile-debug.c (debug_qf_expand_symtabs_matching):
Use expand_symtabs_file_matcher_ftype and
expand_symtabs_symbol_matcher_ftype.
Joel Brobecker [Mon, 10 Feb 2014 13:49:27 +0000 (17:49 +0400)]
[Ada] Make the symbol cache per-program-space.
This patch moves the Ada symbol cache to per-program-space data.
gdb/ChangeLog:
* ada-lang.c (struct cache_entry, HASH_SIZE): Move definition up.
(struct ada_symbol_cache): New.
(ada_free_symbol_cache): Forward declare.
(struct ada_pspace_data): New.
(ada_pspace_data_handle): New static global.
(get_ada_pspace_data, ada_pspace_data_cleanup)
(ada_init_symbol_cache, ada_free_symbol_cache): New functions.
(cache_space, cache): Delete, now folded inside struct
ada_pspace_data.
(ada_get_symbol_cache): New function.
(ada_clear_symbol_cache, find_entry, cache_symbol): Adjust
implementation.
(_initialize_ada_language): Remove initialization of cache_space.
Move call to observer_attach_inferior_exit up, grouping it
with the other observer registrations inside this function.
Rename command to be more general. Add call to
register_program_space_data_with_cleanup.
Joel Brobecker [Fri, 31 Jan 2014 13:56:12 +0000 (17:56 +0400)]
[Ada] Rename some observer callbacks in ada-tasks.c
This patch is mostly cosmetic, avoiding us to use the same callback
names as in ada-lang.c.
gdb/ChangeLog:
* ada-tasks.c (ada_tasks_new_objfile_observer): Renames
ada_new_objfile_observer.
(ada_tasks_normal_stop_observer): Renames ada_normal_stop_observer.
(_initialize_tasks): Update uses of ada_new_objfile_observer
and ada_tasks_normal_stop_observer.
Joel Brobecker [Fri, 7 Feb 2014 04:44:20 +0000 (23:44 -0500)]
Wrong type for 'Length result.
Consider the following code:
type Color is (Black, Red, Green, Blue, White);
type Primary_Table is array (Color range Red .. Blue) of Boolean;
Prim : Primary_Table := (True, False, False);
GDB prints the length of arrays in a fairly odd way:
(gdb) p prim'length
$2 = blue
The length returned should be an integer, not the array index type,
and this patch fixes this.
gdb/ChangeLog:
* ada-lang.c (ada_evaluate_subexp): Set the type of the value
returned by the 'Length attribute to integer.
testsuite/ChangeLog:
* gdb.ada/tick_length_array_enum_idx: New testcase.
Joel Brobecker [Mon, 10 Feb 2014 08:52:15 +0000 (12:52 +0400)]
Add missing call to obstack_init for ada-lang.c::cache_space
This bit was meant to be merged with the following patch:
commit
3d9434b5ddc141178be232048e3d944955cc1f91
Subject: [Ada] Add a symbol lookup cache
... but I forgot :-(. This causes the cache to be undefined, and
with a bit of (bad) luck:
% gdb
(gdb) set lang ada
(gdb) set $xxx := 1
[SEGV]
gdb/ChangeLog:
* ada-lang.c (_initialize_ada_language): Initialize
cache_space obstack.
Joel Brobecker [Mon, 10 Feb 2014 05:03:30 +0000 (09:03 +0400)]
[Ada] Add a symbol lookup cache
This patch implements the caching mechanism alluded to in a comment
next to some stubbed functions.
gdb/ChangeLog:
* ada-lang.c (HASH_SIZE): New macro.
(struct cache_entry): New type.
(cache_space, cache): New static globals.
(ada_clear_symbol_cache, find_entry): New functions.
(lookup_cached_symbol, cache_symbol): Implement.
(ada_new_objfile_observer, ada_free_objfile_observer): New.
(_initialize_ada_language): Attach ada_new_objfile_observer
and ada_free_objfile_observer.
Joel Brobecker [Mon, 10 Feb 2014 04:53:18 +0000 (08:53 +0400)]
struct block parameter constification in ada-lang.c
This patch series constifies a number of struct block * parameters.
gdb/ChangeLog:
* ada-lang.c (ada_add_block_symbols, add_defn_to_vec)
(lookup_cached_symbol, ada_add_local_symbols): Add "const" to
struct block * parameter.
(ada_lookup_symbol_list_worker): Constify local variable "block".
Remove cast which is no longer necessary.
Doug Evans [Mon, 10 Feb 2014 03:40:01 +0000 (19:40 -0800)]
Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
Yao Qi [Sat, 8 Feb 2014 12:54:57 +0000 (20:54 +0800)]
Fix PR16543
Tests in gdb.gdb fail because directory gdb/testsuite/gdb.gdb doesn't
exist in build tree. This patch appends gdb.gdb/Makefile in AC_OUTPUT,
and adds new Makefile.in in gdb.gdb, so that directory gdb.gdb can be
created during configure.
With this patch applied, tests under gdb.gdb can be run,
$ make check RUNTESTFLAGS='--directory=gdb.gdb'
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using ../../../../git/gdb/testsuite/config/unix.exp as tool-and-target-specific interface file.
Running ../../../../git/gdb/testsuite/gdb.gdb/complaints.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/observer.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/python-interrupts.exp ...
FAIL: gdb.gdb/python-interrupts.exp: signal SIGINT
Running ../../../../git/gdb/testsuite/gdb.gdb/python-selftest.exp ...
FAIL: gdb.gdb/python-selftest.exp: call catch_command_errors(execute_command, "python print 5", 0, RETURN_MASK_ALL)
Running ../../../../git/gdb/testsuite/gdb.gdb/selftest.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/xfullpath.exp ...
=== gdb Summary ===
gdb/testsuite:
2014-02-10 Yao Qi <yao@codesourcery.com>
PR testsuite/16543
* configure.ac: Append gdb.gdb/Makefile in AC_OUTPUT.
* configure: Regenerated.
* Makefile.in: New file.
Doug Evans [Mon, 10 Feb 2014 01:39:08 +0000 (17:39 -0800)]
Revert Makefile.in patch to remove all-lib.
Revert this patch (which I approved, mea culpa).
2014-02-08 Mark Kettenis <kettenis@gnu.org>
* Makefile.in (all-lib): Remove.
($(LIBGNU) $(GNULIB_H)): Replace with gits of remove all-lib target.
Doug Evans [Sun, 9 Feb 2014 23:56:36 +0000 (15:56 -0800)]
* section-scripts.h: New file.
Alan Modra [Sun, 9 Feb 2014 23:29:35 +0000 (09:59 +1030)]
binutils potfiles regen
Adds nds32 files to POTFILES.in
Alan Modra [Sun, 9 Feb 2014 23:00:37 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Sun, 9 Feb 2014 17:47:40 +0000 (18:47 +0100)]
Fix Python stack corruption
The fix is obvious.
gdb/
2014-02-09 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix Python stack corruption.
* python/py-linetable.c (ltpy_get_pcs_for_line, ltpy_has_line): Use
gdb_py_longest.
Message-ID: <
20140207171701.GA25187@host2.jankratochvil.net>
Alan Modra [Sat, 8 Feb 2014 01:56:53 +0000 (12:26 +1030)]
powerpc relax_section and section contents cache
This patch provides a means for backend relax_section support to
increase the size of a section without needing to reallocate
section contents. This helps reduce memory usage when the added space
does not need to be written in relax_section, as is the case for
powerpc. Writing the stubs later means a few tweaks are needed in the
powerpc relocate_section function, but also removes some code
duplication since the extra ld -r relocs can be written there too.
* elf-bfd.h (struct elf_backend_data): Add caches_rawsize.
* elfxx-target.h (elf_backend_caches_rawsize): Define.
(elfNN_bed): Init new field.
* elflink.c (elf_link_input_bfd): Handle caches_rawsize.
* elf32-ppc.c (shared_stub_entry): Zero addi offset.
(ppc_elf_relax_section): Don't reallocate section here, write
stubs, or write out relocs for ld -r here..
(ppc_elf_relocate_section): ..instead write stubs here, and use
existing code to write out relocs for ld -r. Fix offset
adjustment on reloc for little-endian.
(elf_backend_caches_rawsize): Define.
Alan Modra [Sat, 8 Feb 2014 23:01:14 +0000 (09:31 +1030)]
daily update
Mark Kettenis [Sat, 8 Feb 2014 11:36:17 +0000 (12:36 +0100)]
A phony target should not be a prerequisite of a real target file
gdb/ChangeLog:
* Makefile.in (all-lib): Remove.
($(LIBGNU) $(GNULIB_H)): Replace with gits of remove all-lib target.
Andreas Schwab [Sat, 8 Feb 2014 09:43:24 +0000 (10:43 +0100)]
Fix typo in test name
* gdb.python/py-framefilter.exp: Fix typo.
Yao Qi [Fri, 24 Jan 2014 03:05:06 +0000 (11:05 +0800)]
Test no =breakpoint-modified is emitted for modifications from MI commands
As design, =breakpoint-modified isn't emitted when breakpoints are modified
by MI commands. This patch is to add tests for this.
gdb/testsuite:
2014-02-08 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Test
that no =breakpoint-modified is emitted when breakpoints are
modified through MI commands.
Alan Modra [Fri, 7 Feb 2014 23:00:39 +0000 (09:30 +1030)]
daily update
Doug Evans [Fri, 7 Feb 2014 19:56:58 +0000 (11:56 -0800)]
add forgotten entry in previous checkin
(active_ext_lang_state): Fix typo in comment.
Doug Evans [Fri, 7 Feb 2014 19:43:19 +0000 (11:43 -0800)]
* extension-priv.h (extension_language_script_ops): Add comment.
(extension_language_ops): Add comment.
Pedro Alves [Fri, 7 Feb 2014 19:11:25 +0000 (19:11 +0000)]
Make sure we don't resume the stepped thread by accident.
Say:
<stopped at a breakpoint in thread 2>
(gdb) thread 3
(gdb) step
The above triggers the prepare_to_proceed/deferred_step_ptid process,
which switches back to thread 2, to step over its breakpoint before
getting back to thread 3 and "step" it.
If while stepping over the breakpoint in thread 2, a signal arrives,
and it is set to pass/nostop, we'll set a step-resume breakpoint at
the supposed signal-handler resume address, and call keep_going. The
problem is that we were supposedly stepping thread 3, and that
keep_going delivers a signal to thread 2, and due to scheduler-locking
off, resumes everything else, _including_ thread 3, the thread we want
stepping. This means that we lose control of thread 3 until the next
event, when we stop everything. The end result for the user, is that
GDB lost control of the "step".
Here's the current infrun debug output of the above, with the testcase
in the patch below:
infrun: clear_proceed_status_thread (Thread 0x2aaaab8f5700 (LWP 11663))
infrun: clear_proceed_status_thread (Thread 0x2aaaab6f4700 (LWP 11662))
infrun: clear_proceed_status_thread (Thread 0x2aaaab4f2b20 (LWP 11659))
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1)
infrun: prepare_to_proceed (step=1), switched to [Thread 0x2aaaab6f4700 (LWP 11662)]
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun: status->kind = stopped, signal = SIGUSR1
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: random signal 30
Program received signal SIGUSR1, User defined signal 1.
infrun: signal arrived while stepping over breakpoint
infrun: inserting step-resume breakpoint at 0x40098f
infrun: resume (step=0, signal=30), trap_expected=0, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f
^^^ this is a wildcard resume.
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: BPSTAT_WHAT_STEP_RESUME
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f
^^^ step-resume hit, meaning the handler returned, so we go back to stepping thread 3.
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40088b
infrun: switching back to stepped thread
infrun: Switching context from Thread 0x2aaaab6f4700 (LWP 11662) to Thread 0x2aaaab8f5700 (LWP 11663)
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x400938
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40093a
infrun: keep going
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x40093a
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40091e
infrun: stepped to a different line
infrun: stop_stepping
[Switching to Thread 0x2aaaab8f5700 (LWP 11663)]
69 (*myp) ++; /* set breakpoint child_two here */
^^^ we stopped at the wrong line. We still stepped a bit because the
test is running in a loop, and when we got back to stepping thread 3,
it happened to be in the stepping range. (The loop increments a
counter, and the test makes sure it increments exactly once. Without
the fix, the counter increments a bunch, since the user-stepped thread
runs free without GDB noticing.)
The fix is to switch to the stepping thread before continuing for the
step-resume breakpoint.
gdb/
2014-02-07 Pedro Alves <palves@redhat.com>
* infrun.c (handle_signal_stop) <signal arrives while stepping
over a breakpoint>: Switch back to the stepping thread.
gdb/testsuite/
2014-02-07 Pedro Alves <pedro@codesourcery.com>
Pedro Alves <palves@redhat.com>
* gdb.threads/step-after-sr-lock.c: New file.
* gdb.threads/step-after-sr-lock.exp: New file.
Pedro Alves [Wed, 30 Oct 2013 15:07:07 +0000 (15:07 +0000)]
Fix gdb.threads/stepi-random-signal.exp on software single-step targets.
Currently on software single-step Linux targets we get:
(gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc"
stepi
infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 7073))
infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 7069))
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 7069)] at 0x400700
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 7069 [Thread 0x7ffff7fcb740 (LWP 7069)],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400704
infrun: software single step trap for Thread 0x7ffff7fcb740 (LWP 7069)
infrun: stepi/nexti
infrun: stop_stepping
44 while (counter != 0)
(gdb) FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal)
Vs hardware-step targets:
(gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc"
stepi
infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 9565))
infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 9561))
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)],
infrun: status->kind = stopped, signal = GDB_SIGNAL_CHLD
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400700
infrun: random signal (GDB_SIGNAL_CHLD)
infrun: random signal, keep going
infrun: resume (step=1, signal=GDB_SIGNAL_CHLD), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400704
infrun: stepi/nexti
infrun: stop_stepping
44 while (counter != 0)
(gdb) PASS: gdb.threads/stepi-random-signal.exp: stepi
The test turns on infrun debug, does a stepi while a SIGCHLD is
pending, and checks whether the "random signal" paths in infrun.c are
taken.
On the software single-step variant above, those paths were not taken.
This is a test bug.
The Linux backend short-circuits reporting signals that are set to
pass/nostop/noprint. But _only_ if the thread is _not_
single-stepping. So on hardware-step targets, even though the signal
is set to pass/nostop/noprint by default, the thread is indeed told to
single-step, and so the core sees the signal. On the other hand, on
software single-step architectures, the backend never actually gets a
single-step request (steps are emulated by setting a breakpoint at the
next pc, and then the target told to continue, not step). So the
short-circuiting code triggers and the core doesn't see the signal.
The fix is to make the test be sure the target doesn't bypass
reporting the signal to the core.
Tested on x86_64 Fedora 17, both with and without a series that
implements software single-step for x86_64.
gdb/testsuite/
2014-02-07 Pedro Alves <palves@redhat.com>
* gdb.threads/stepi-random-signal.exp: Set SIGCHLD to print.
Rainer Orth [Fri, 7 Feb 2014 14:44:58 +0000 (15:44 +0100)]
* cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.
Yao Qi [Wed, 29 Jan 2014 03:48:40 +0000 (11:48 +0800)]
Return early in target_xfer_partial when LEN is zero.
Nowadays, argument LEN of to_xfer_partial can be zero in some cases,
and each implementation may do nothing and return zero, indicating
transfer is done. That is fine. However, when we change
to_xfer_partial to return target_xfer_status, we have to check every
return value of most of to_xfer_partial implementations, return
TARGET_XFER_DONE if return value is zero.
This patch simplifies this by checking LEN in target_xfer_partial, and
return 0 if LEN is zero. Regression tested on x86_84-linux. Is it
OK?
gdb:
2014-02-07 Yao Qi <yao@codesourcery.com>
* target.c (target_xfer_partial): Return zero if LEN is zero.
Yao Qi [Mon, 27 Jan 2014 09:32:33 +0000 (17:32 +0800)]
Replace -1 with TARGET_XFER_E_IO
Hi,
This patch replaces -1 with TARGET_XFER_E_IO in the implementations of
to_xfer_partial and their callees. This change is quite mechanical,
and makes the next patch shorter.
gdb:
2014-02-07 Yao Qi <yao@codesourcery.com>
* auxv.c (procfs_xfer_auxv): Replace -1 with TARGET_XFER_E_IO.
(ld_so_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise.
(darwin_xfer_partial): Likewise.
* exec.c (exec_xfer_partial): Likewise.
* gnu-nat.c (gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_uregs): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo): Likewise.
(linux_proc_xfer_spu): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_qxfer): Likewise.
(remote_write_qxfer, remote_read_qxfer): Likewise.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
(spu_xfer_partial): Likewise.
* target.c (memory_xfer_partial_1): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
Yao Qi [Mon, 27 Jan 2014 04:56:56 +0000 (12:56 +0800)]
core_xfer_shared_libraries and core_xfer_shared_libraries_aix returns ULONGEST
This patch documents the return value of core_xfer_shared_libraries_aix
and core_xfer_shared_libraries gdbarch methods, and changes return
type to ULONGEST from LONGEST.
In a following patch, core_xfer_partial. is changed to check their
return values and return an appropriate target_xfer_status.
gdb:
2014-02-07 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (core_xfer_shared_libraries): Returns ULONGEST. Add
comments.
(core_xfer_shared_libraries_aix): Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries): Return
ULONGEST. Change 'len_avail' type to ULONGEST.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
* rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update
declaration.
(rs6000_aix_core_xfer_shared_libraries_aix): Return ULONGEST.
Yao Qi [Mon, 4 Nov 2013 00:51:19 +0000 (08:51 +0800)]
Tweak in memory_error
This patch adds a local variable exception of type 'enum errors' and
pass it to throw_error, because 'err' is of type
'enum target_xfer_error', and we're abusing it to store an 'enum errors'.
gdb:
2014-02-07 Yao Qi <yao@codesourcery.com>
* corefile.c (memory_error): Get 'exception' from ERR and pass
'exception' to throw_error.
Cary Coutant [Fri, 7 Feb 2014 01:12:50 +0000 (17:12 -0800)]
Fix problem where -u is ignored when a weak undef is seen.
When the linker has a weak undefined symbol, it normally does not
select an archive library member just to satisfy the reference.
If the same symbol is also listed in a -u option, however, we
should select the archive library member. This patch reorders
the code in Library_base::should_include_member so that the
additional checks are performed in the case of a weak undef.
gold/
2014-02-06 Cary Coutant <ccoutant@google.com>
* archive.cc (Library_base::should_include_member): Reorder
code to check for -u option if a weak undef has already been seen.
* testsuite/Makefile.am (weak_undef_test_2): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/weak_undef_file3.cc: New file.
* testsuite/weak_undef_file4.cc: New file.
* testsuite/weak_undef_test_2.cc: New file.
Alan Modra [Thu, 6 Feb 2014 23:00:40 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Thu, 6 Feb 2014 22:14:20 +0000 (23:14 +0100)]
Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
gdb/testsuite/
2014-02-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
* gdb.arch/i386-sse-stack-align.exp: Use standard_output_file.
Andrew Pinski [Thu, 6 Feb 2014 19:26:26 +0000 (11:26 -0800)]
binutils/ChangeLog:
2014-02-06 Andrew Pinski <apinski@cavium.com>
* readelf.c (get_machine_flags): Handle E_MIPS_MACH_OCTEON3 case.
elfcpp/ChangeLog:
2014-02-06 Andrew Pinski <apinski@cavium.com>
* mips.h (E_MIPS_MACH_OCTEON3): New enum constant.
include/elf/ChangeLog:
2014-02-06 Andrew Pinski <apinski@cavium.com>
* mips.h (E_MIPS_MACH_OCTEON3): New machine flag.
Tom Tromey [Thu, 6 Feb 2014 19:04:50 +0000 (12:04 -0700)]
indentation fixlet in gdbserver/Makefile.in.
This fixes a minor indentation issue in gdbserver/Makefile.in.
2014-02-06 Tom Tromey <tromey@redhat.com>
* Makefile.in (SFILES): Fix indentation.
Cary Coutant [Wed, 5 Feb 2014 18:29:24 +0000 (10:29 -0800)]
Add readelf support for dumping gold version note sections.
binutils/
PR binutils/16444
* readelf.c (print_gnu_note): Add support for NT_GNU_GOLD_VERSION.
Rainer Orth [Thu, 6 Feb 2014 10:01:57 +0000 (11:01 +0100)]
PR target/59788
* ltmain.sh (opt_duplicate_compiler_generated_deps): Enable on
*solaris2*.
Cary Coutant [Thu, 6 Feb 2014 06:59:02 +0000 (22:59 -0800)]
Fix issues with gold undefined symbol diagnostics.
PR binutils/15435 complains that gold issues a visibility error for an
weak undefined symbol with hidden visibility. The message should be
suppressed if the symbol is a weak undef.
An earlier patch to add an extra note about key functions when a class's
vtable symbol is undefined missed a case where the reference to the
vtable came from a shared library. This patch moves the check to a
lower-level routine that catches both cases.
gold/
2014-02-05 Cary Coutant <ccoutant@google.com>
* errors.cc (Errors::undefined_symbol): Move undef vtable symbol
check to here.
* target-reloc.h (is_strong_undefined): New function.
(relocate_section): Move undef vtable symbol check from here.
Check for is_strong_undefined.
Cary Coutant [Thu, 6 Feb 2014 06:57:51 +0000 (22:57 -0800)]
Add missing gold/ChangeLog entry.
Doug Evans [Thu, 6 Feb 2014 04:17:30 +0000 (20:17 -0800)]
fix copyright year in new files in previous checkin
Doug Evans [Thu, 6 Feb 2014 03:27:58 +0000 (19:27 -0800)]
Extension Language API
* configure.ac (libpython checking): Remove all but python.o from
CONFIG_OBS. Remove all but python.c from CONFIG_SRCS.
* configure: Regenerate.
* Makefile.in (SFILES): Add extension.c.
(HFILES_NO_SRCDIR): Add extension.h, extension-priv.h
(COMMON_OBS): Add extension.o.
* extension.h: New file.
* extension-priv.h: New file.
* extension.c: New file.
* python/python-internal.h: #include "extension.h".
(gdbpy_auto_load_enabled): Declare.
(gdbpy_apply_val_pretty_printer): Declare.
(gdbpy_apply_frame_filter): Declare.
(gdbpy_preserve_values): Declare.
(gdbpy_breakpoint_cond_says_stop): Declare.
(gdbpy_breakpoint_has_cond): Declare.
(void source_python_script_for_objfile): Delete.
* python/python.c: #include "extension-priv.h".
Delete inclusion of "observer.h".
(extension_language_python): Moved here and renamed from
script_language_python in py-auto-load.c.
Redefined to be of type extension_language_defn.
(python_extension_script_ops): New global.
(python_extension_ops): New global.
(struct python_env): New member previous_active.
(restore_python_env): Call restore_active_ext_lang.
(ensure_python_env): Call set_active_ext_lang.
(gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static.
New arg extlang.
(gdbpy_set_quit_flag): Renamed from set_quit_flag, made static.
New arg extlang.
(gdbpy_check_quit_flag): Renamed from check_quit_flag, made static.
New arg extlang.
(gdbpy_eval_from_control_command): Renamed from
eval_python_from_control_command, made static. New arg extlang.
(gdbpy_source_script) Renamed from source_python_script, made static.
New arg extlang.
(gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change
result to int. New arg extlang.
(gdbpy_source_objfile_script): Renamed from
source_python_script_for_objfile, made static. New arg extlang.
(gdbpy_start_type_printers): Renamed from start_type_printers, made
static. New args extlang, extlang_printers. Change result type to
"void".
(gdbpy_apply_type_printers): Renamed from apply_type_printers, made
static. New arg extlang. Rename arg printers to extlang_printers
and change type to ext_lang_type_printers *.
(gdbpy_free_type_printers): Renamed from free_type_printers, made
static. Replace argument arg with extlang, extlang_printers.
(!HAVE_PYTHON, eval_python_from_control_command): Delete.
(!HAVE_PYTHON, source_python_script): Delete.
(!HAVE_PYTHON, gdbpy_should_stop): Delete.
(!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete.
(!HAVE_PYTHON, start_type_printers): Delete.
(!HAVE_PYTHON, apply_type_printers): Delete.
(!HAVE_PYTHON, free_type_printers): Delete.
(_initialize_python): Delete call to observer_attach_before_prompt.
(finalize_python): Set/restore active extension language.
(gdbpy_finish_initialization) Renamed from
finish_python_initialization, made static. New arg extlang.
(gdbpy_initialized): New function.
* python/python.h: #include "extension.h". Delete #include
"value.h", "mi/mi-cmds.h".
(extension_language_python): Declare.
(GDBPY_AUTO_FILE_NAME): Delete.
(enum py_bt_status): Moved to extension.h and renamed to
ext_lang_bt_status.
(enum frame_filter_flags): Moved to extension.h.
(enum py_frame_args): Moved to extension.h and renamed to
ext_lang_frame_args.
(finish_python_initialization): Delete.
(eval_python_from_control_command): Delete.
(source_python_script): Delete.
(apply_val_pretty_printer): Delete.
(apply_frame_filter): Delete.
(preserve_python_values): Delete.
(gdbpy_script_language_defn): Delete.
(gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete.
(start_type_printers, apply_type_printers, free_type_printers): Delete.
* auto-load.c: #include "extension.h".
(GDB_AUTO_FILE_NAME): Delete.
(auto_load_gdb_scripts_enabled): Make public. New arg extlang.
(script_language_gdb): Delete, moved to extension.c and renamed to
extension_language_gdb.
(source_gdb_script_for_objfile): Delete.
(auto_load_pspace_info): New member unsupported_script_warning_printed.
(loaded_script): Change type of language member to
struct extension_language_defn *.
(init_loaded_scripts_info): Initialize
unsupported_script_warning_printed.
(maybe_add_script): Make static. Change type of language arg to
struct extension_language_defn *.
(clear_section_scripts): Reset unsupported_script_warning_printed.
(auto_load_objfile_script_1): Rewrite to use extension language API.
(auto_load_objfile_script): Make public. Remove support-compiled-in
and auto-load-enabled checks, moved to auto_load_scripts_for_objfile.
(source_section_scripts): Rewrite to use extension language API.
(load_auto_scripts_for_objfile): Rewrite to use
auto_load_scripts_for_objfile.
(collect_matching_scripts_data): Change type of language member to
struct extension_language_defn *.
(auto_load_info_scripts): Change type of language arg to
struct extension_language_defn *.
(unsupported_script_warning_print): New function.
(script_not_found_warning_print): Make static.
(_initialize_auto_load): Rewrite construction of scripts-directory
help.
* auto-load.h (struct objfile): Add forward decl.
(struct script_language): Delete.
(struct auto_load_pspace_info): Add forward decl.
(struct extension_language_defn): Add forward decl.
(maybe_add_script): Delete.
(auto_load_objfile_script): Declare.
(script_not_found_warning_print): Delete.
(auto_load_info_scripts): Update prototype.
(auto_load_gdb_scripts_enabled): Declare.
* python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from
auto_load_python_scripts_enabled and made public.
(script_language_python): Delete, moved to python.c.
(gdbpy_script_language_defn): Delete.
(info_auto_load_python_scripts): Update to use
extension_language_python.
* breakpoint.c (condition_command): Replace call to
gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang.
(bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop
with call to breakpoint_ext_lang_cond_says_stop.
* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
from gdbpy_should_stop. Change result type to enum scr_bp_stop.
New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL.
(gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond.
New arg slang.
(local_setattro): Print name of extension language with existing
stop condition.
* valprint.c (val_print, value_print): Update to call
apply_ext_lang_val_pretty_printer.
* cp-valprint.c (cp_print_value): Update call to
apply_ext_lang_val_pretty_printer.
* python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON.
(gdbpy_apply_val_pretty_printer): Renamed from
apply_val_pretty_printer. New arg extlang.
(!HAVE_PYTHON, apply_val_pretty_printer): Delete.
* cli/cli-cmds.c (source_script_from_stream): Rewrite to use
extension language API.
* cli/cli-script.c (execute_control_command): Update to call
eval_ext_lang_from_control_command.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use
enum ext_lang_bt_status values. Update call to
apply_ext_lang_frame_filter.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* mi/mi-main.c: Delete #include "python/python-internal.h".
Add #include "extension.h".
(mi_cmd_list_features): Replace reference to python internal variable
gdb_python_initialized with call to ext_lang_initialized_p.
* stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status.
Update to use enum ext_lang_frame_args. Update to call
apply_ext_lang_frame_filter.
* python/py-framefilter.c (extract_sym): Update to use enum
ext_lang_bt_status.
(extract_value, py_print_type, py_print_value): Ditto.
(py_print_single_arg, enumerate_args, enumerate_locals): Ditto.
(py_mi_print_variables, py_print_locals, py_print_args): Ditto.
(py_print_frame): Ditto.
(gdbpy_apply_frame_filter): Renamed from apply_frame_filter.
New arg extlang. Update to use enum ext_lang_bt_status.
* top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to
finish_python_initialization. Replace with call to
finish_ext_lang_initialization.
* typeprint.c (do_free_global_table): Update to call
free_ext_lang_type_printers.
(create_global_typedef_table): Update to call
start_ext_lang_type_printers.
(find_global_typedef): Update to call apply_ext_lang_type_printers.
* typeprint.h (struct ext_lang_type_printers): Add forward decl.
(type_print_options): Change type of global_printers from "void *"
to "struct ext_lang_type_printers *".
* value.c (preserve_values): Update to call preserve_ext_lang_values.
* python/py-value.c: Remove #ifdef HAVE_PYTHON.
(gdbpy_preserve_values): Renamed from preserve_python_values.
New arg extlang.
(!HAVE_PYTHON, preserve_python_values): Delete.
* utils.c (quit_flag): Delete, moved to extension.c.
(clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to
extension.c.
* eval.c: Delete #include "python/python.h".
* main.c: Delete #include "python/python.h".
* defs.h: Update comment.
testsuite/
* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
output.
* gdb.gdb/python-interrupts.exp: New file.
Joel Brobecker [Thu, 6 Feb 2014 02:48:24 +0000 (06:48 +0400)]
Document the GDB 7.7 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 7.7 released.
Cary Coutant [Wed, 5 Feb 2014 22:01:52 +0000 (14:01 -0800)]
Fix problems with the --dynamic-list option.
PR gold/13577 complains that even though symbols listed in
the --dynamic-list script are exported, they are still bound symbolically
if -Bsymbolic is also used. There are two underlying problems here.
First, -Bsymbolic should be overridden by --dynamic-list, since the
dynamic list provides an explicit list of symbols that are not bound
within the library, and if we go ahead and set DT_SYMBOLIC, then the
dynamic loader will bind it within the library anyway. Second, gold
did not properly identify the symbols listed in the file as preemptible.
PR gold/16530 complains that symbols listed in the --dynamic-list script
can still be garbage collected. I've fixed this by checking the symbols
as they're added to the symbol table. (Unlike the --export-dynamic-symbol
option, we can't iterate over the list, because the --dynamic-list script
can have wildcards in it.)
gold/
2014-02-05 Cary Coutant <ccoutant@google.com>
PR gold/13577
* options.cc (General_options::parse_dynamic_list):
Set have_dynamic_list_.
(General_options::General_options): Initialize have_dynamic_list_.
(General_options::finalize): Turn off -Bsymbolic and
-Bsymbolic-functions if --dynamic-list provided.
* options.h (General_options::have_dynamic_list): New function.
(General_options::have_dynamic_list_): New data member.
* symtab.h (Symbol::is_preemptible): Handle --dynamic-list
correctly.
PR gold/16530
* symtab.cc (Symbol_table::add_from_relobj): If symbol is named
in --dynamic-list, mark it.
* testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
(dynamic_list_2): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/dynamic_list_2.cc: New file.
* testsuite/dynamic_list_2.t: New file.
* testsuite/dynamic_list_lib1.cc: New file.
* testsuite/dynamic_list_lib2.cc: New file.
* testsuite/gc_dynamic_list_test.c: New file.
* testsuite/gc_dynamic_list_test.sh: New file.
* testsuite/gc_dynamic_list_test.t: New file.
Doug Evans [Thu, 6 Feb 2014 00:08:59 +0000 (16:08 -0800)]
Keep current_inferior in sync with event_child.
* linux-low.c (linux_wait_for_event): Improve comment.
(linux_wait_1): Keep current_inferior in sync with event_child.
Alan Modra [Wed, 5 Feb 2014 23:01:11 +0000 (09:31 +1030)]
daily update
Mark Kettenis [Wed, 5 Feb 2014 12:30:33 +0000 (13:30 +0100)]
Avoid bison-isms when using yacc.
YYPRINT is a bison-ism so c_print_token() ends up being unused when yacc is
used which makes gcc unhappy. Make sure we only define YYPRINT and
c_print_token() when bison is used to generate the parser.
gdb/ChangeLog:
* c-exp.y (YYPRINT, c_print_token): Only define if YYBISON is
defined.
Yao Qi [Mon, 20 Jan 2014 12:56:13 +0000 (20:56 +0800)]
Use rs->buf after getpkt
Hi,
The following code snippet looks wrong to me
char *buf = rs->buf;
getpkt (&rs->buf, &rs->buf_size, 0);
packet_ok (buf, );
if rs->buf is reallocated in getpkt, buf points to an out of dated
memory. This patch removes local 'buf' and uses rs->buf.
gdb:
2014-02-05 Yao Qi <yao@codesourcery.com>
* remote.c (remote_pass_signals): Remove local 'buf' and use
rs->buf.
(remote_program_signals): Likewise.
Yao Qi [Thu, 30 Jan 2014 02:09:11 +0000 (10:09 +0800)]
Create inferior for ctf target.
This patch creates inferior when GDB opens a ctf trace data, to be
consistent with tfile target. A test case is added to test for
live target, tfile and ctf target.
gdb:
2014-02-05 Yao Qi <yao@codesourcery.com>
* ctf.c: Include "inferior.h" and "gdbthread.h".
(CTF_PID): A new macro.
(ctf_open): Call inferior_appeared and add_thread_silent.
(ctf_close): Call exit_inferior_silent and set inferior_ptid.
(ctf_thread_alive): New function.
(init_ctf_ops): Install ctf_thread_alive to to_thread_alive.
gdb/testsuite:
2014-02-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/report.exp (use_collected_data): Test the output
of "info threads" and "info inferiors".
Yao Qi [Thu, 30 Jan 2014 00:37:05 +0000 (08:37 +0800)]
Create inferior for tfile target
When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created). Create an
inferior and add a thread for this purpose.
This patch just reverts my previous patch.
gdb/testsuite:
2014-02-05 Yao Qi <yao@codesourcery.com>
Revert this patch:
2013-05-24 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.exp: Test inferior and thread.
gdb:
2014-02-05 Yao Qi <yao@codesourcery.com>
Revert this patch:
2013-05-24 Yao Qi <yao@codesourcery.com>
* tracepoint.c (TFILE_PID): Remove.
(tfile_open): Don't add thread and inferior.
(tfile_close): Don't set 'inferior_ptid'. Don't call
exit_inferior_silent.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set field 'to_thread_alive' of
tfile_ops.
Alan Modra [Tue, 4 Feb 2014 23:00:41 +0000 (09:30 +1030)]
daily update
Christian Eggers [Tue, 4 Feb 2014 19:42:12 +0000 (19:42 +0000)]
Call remote_check_symbols even if only symbol-file (not file) has been given
The Eclipse "C/C++ GDB Hardware Debugging" plugin runs only the
"symbol-file" command. In this case, remote_check_symbols is not
called and no qSymbol:: packet is sent to the server (OpenOCD in my
case).
gdb/
2014-02-04 Christian Eggers <ceggers@gmx.de> (tiny change)
* remote.c (remote_start_remote): Call remote_check_symbols even
if only symbol-file (not file) has been given.
Jan Kratochvil [Tue, 4 Feb 2014 19:17:16 +0000 (20:17 +0100)]
Fix PowerPC targets minor memory leaks found by Coverity
bfd/
2014-02-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* coff-rs6000.c (xcoff_write_archive_contents_big): Free OFFSETS in
return paths. Three times.
* elf64-ppc.c (ppc64_elf_link_hash_table_create): Free HTAB in all
return paths.
(ppc64_elf_tls_optimize): Free TOC_REF in return path.
(ppc64_elf_edit_toc): Free USED in return path.
Ulrich Weigand [Tue, 4 Feb 2014 17:44:14 +0000 (18:44 +0100)]
PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.
In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself. The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.
Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point. Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.
One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point. Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...
Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.
Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.
As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.
With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:
gdb_test "break *hello"
Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.
I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...
In one of those two test cases, use of this construct is really
not appropriate. I think this was added way back when as a means
to work around prologue skipping problems on some platforms. These
days that shouldn't really be necessary any more ...
For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine. To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).
gdb/ChangeLog:
* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.
gdb/testsuite/ChangeLog:
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.
Ulrich Weigand [Tue, 4 Feb 2014 17:42:35 +0000 (18:42 +0100)]
PowerPC64 ELFv2 ABI: structure passing / return
Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters. (This is similar to the ARM ABI.) This
applies to both calls and returns.
In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.
This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
(ppc64_sysv_abi_return_value): Likewise. Also, handle small
structures returned in GPRs.
Ulrich Weigand [Tue, 4 Feb 2014 17:41:36 +0000 (18:41 +0100)]
PowerPC64 ELFv2 ABI: stack frame layout changes
This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway). This
affects placement of on-stack parameters in inferior calls.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
offset to the stack parameter list for the ELFv2 ABI.
Ulrich Weigand [Tue, 4 Feb 2014 17:40:16 +0000 (18:40 +0100)]
PowerPC64 ELFv2 ABI: no function descriptors
This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors. The patch consists mostly
of switching off code to deal with descriptors :-)
In addition, when calling an inferior function, we no longer need
to provide its TOC in r2. Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.
gdb/ChangeLog:
* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
set_gdbarch_convert_from_func_ptr_addr and
set_gdbarch_elf_make_msymbol_special for ELFv1.
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
function descriptors on ELFv1.
(ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2,
set up r12 at function entry.
Ulrich Weigand [Tue, 4 Feb 2014 17:38:56 +0000 (18:38 +0100)]
PowerPC64 ELFv2 ABI: base support
This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI. While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).
Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use. This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.
This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs. Those will be added by the remainder
of this patch series.
For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html
gdb/ChangeLog:
* ppc-tdep.h (enum powerpc_elf_abi): New data type.
(struct gdbarch_tdep): New member elf_abi.
* rs6000-tdep.c: Include "elf/ppc64.h".
(rs6000_gdbarch_init): Detect ELF ABI version.
Ulrich Weigand [Tue, 4 Feb 2014 17:34:19 +0000 (18:34 +0100)]
PowerPC64 little-endian fixes: 128-bit DFP parameters / registers
The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value. This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.
This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence. For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong. This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior. But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too. (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
within a register pair holding a DFP 128-bit value on little-endian.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
(dfp_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
Ulrich Weigand [Tue, 4 Feb 2014 17:33:04 +0000 (18:33 +0100)]
PowerPC64 little-endian fixes: 32-bit DFP parameters
Passing a 32-bit DFP in register needs to use the least-significant part
of the register. Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
offset on little-endian when passing _Decimal32.
(ppc64_sysv_abi_return_value_base): Likewise for return values.
Ulrich Weigand [Tue, 4 Feb 2014 17:31:38 +0000 (18:31 +0100)]
PowerPC64 little-endian fixes: VSX tests and pseudo-regs
Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.
This patch adds such patterns, along the lines of altivec-regs.exp.
In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems. However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0). This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.
This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.
gdb/ChangeLog:
* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
of the overlapped FP register within the VSX register on little-
endian platforms.
(efpr_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
of the test patterns for use on little-endian systems.
Ulrich Weigand [Tue, 4 Feb 2014 17:28:24 +0000 (18:28 +0100)]
PowerPC64 little-endian fixes: AltiVec tests
A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern. Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).
This patch updates the pattern to the new GDB output behavior.
In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.
gdb/testsuite/ChangeLog:
* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.
Ulrich Weigand [Tue, 4 Feb 2014 17:26:26 +0000 (18:26 +0100)]
PowerPC64 little-endian fixes: structure passing
When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot). On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.
However, on little-endian systems, the least-significant bytes are
addresses with offset 0. This patch fixes that.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.
Ulrich Weigand [Tue, 4 Feb 2014 17:24:42 +0000 (18:24 +0100)]
Refactor ppc64 function call and return value handling
This patch refactors the ppc64 function call and return value handling code
in ppc-sysv-tdep.c. The main problem to be addressed by this refactoring
is the code duplication caused by certain aggregate types:
According to the ABI, some types are to be decomposed into component types
for parameter and return value handling. For example, complex types are
to be passed as if the real and imaginary component were separate arguments.
Similarly, certain OpenCL vector types are passed as if they were multiple
separate arguments of the vector element type. With the new ELFv2 ABI,
there is another case: "homogeneous aggregates" (e.g. a struct containing
4 floats) are passed in multiple floating point registers as well.
Unfortunately, the current code is not structured to easily model these
ABI properties. For example, code to pass complex values re-implements
code to pass the underlying (floating-point) type. This has already
led to some unfortunate code duplication, and with the addition of
ELFv2 ABI support, I would have had to add yet more such duplication.
To avoid that, I've decided to refactor the code in order to re-use
subroutines that handle the "base" types when handling those aggregate
types. This was not intended to cause any difference on current
(ELFv1) ABI code, but in fact it fixes a bug:
FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)
This was caused by the old code in ppc64_sysv_abi_push_float incorrectly
handling floating-point arguments to vararg routines, which just happens
to work out correctly automatically in the refactored code ...
gdb/ChangeLog:
* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
(struct ppc64_sysv_argpos): New data structure.
(ppc64_sysv_abi_push_float): Remove.
(ppc64_sysv_abi_push_val): New function.
(ppc64_sysv_abi_push_integer): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_push_vreg): Likewise.
(ppc64_sysv_abi_push_param): Likewise.
(ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines.
(ppc64_sysv_abi_return_value_base): New function.
(ppc64_sysv_abi_return_value): Refactor to use it.
Ulrich Weigand [Tue, 4 Feb 2014 17:19:51 +0000 (18:19 +0100)]
Document support for powerpc64le-*-linux* target
gdb/ChangeLog:
* NEWS: Document new target powerpc64le-*-linux*.
Mark Kettenis [Tue, 4 Feb 2014 12:18:15 +0000 (13:18 +0100)]
Add support for ELF core files on OpenBSD/sparc64.
gdb/ChangeLog:
* sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
(sparc64obsd_supply_gregset): Handle registers sets used in ELF
core dumps.
(sparc64obsd_init_abi): Adjust minimum size of the general purpose
register set used in ELF core dumps. Add floating-point register set.
Kevin Buettner [Tue, 4 Feb 2014 04:52:59 +0000 (21:52 -0700)]
Update mn10300 dwarf register map
This change updates the mn10300 dwarf register map. It reduces the
failure count when doing simulator testing against the default
multilib from 788 to 99.
gdb/ChangeLog:
* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Rewrite
dwarf2_to_gdb[] table using symbolic constants. Adjust
penultimate entry from number representing the PC register
to symbolic constant representing the MDR register. Add
constant for the PC register to the end of the table.
Alan Modra [Mon, 3 Feb 2014 23:00:46 +0000 (09:30 +1030)]
daily update
Sandra Loosemore [Mon, 3 Feb 2014 16:42:42 +0000 (08:42 -0800)]
Nios II large-GOT relocations
2014-02-03 Sandra Loosemore <sandra@codesourcery.com>
include/elf/
* nios2.h (R_NIOS2_GOT_LO, R_NIOS2_GOT_HA): New.
(R_NIOS2_CALL_LO, R_NIOS2_CALL_HA): New.
(R_NIOS2_ILLEGAL): Adjust.
gas/
* config/tc-nios2.c (md_apply_fix): Test for new relocs.
(nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo,
%got_hiadj relocation operators. Sort table and add comment
to explain ordering.
(nios2_fix_adjustable): Test for new relocs.
* doc/c-nios2.texi (Nios II Relocations): Document new relocation
operators.
bfd/
* reloc.c (BFD_RELOC_NIOS2_GOT_LO, BFD_RELOC_NIOS2_GOT_HA): New.
(BFD_RELOC_NIOS2_CALL_LO, BFD_RELOC_NIOS2_CALL_HA): New.
* libbfd.h: Regenerated.
* bfd-in2.h: Regenerated.
* elf32-nios2.c (elf_nios2_howto_table_rel): Add new relocations.
(nios2_reloc_map): Likewise.
(GOT_USED, CALL_USED): Renamed from GOT16_USED and CALL16_USED.
Fixed all references.
(nios2_elf32_relocate_section): Add new relocations.
(nios2_elf32_check_relocs): Likewise.
(nios2_elf32_gc_sweep_hook): Likewise.
Mark Kettenis [Mon, 3 Feb 2014 13:38:59 +0000 (14:38 +0100)]
Fix build on recent versions of OpenBSD.
gdb/ChangeLog:
* bsd-kvm.c: Include <sys/param.h>
Mark Kettenis [Mon, 3 Feb 2014 13:29:28 +0000 (14:29 +0100)]
Fix build on OpenBSD/sparc64.
gdb/ChangeLog:
* sparc64nbsd-nat.c (sparc64nbsd_supply_fpregset): Fix prototype.
Alan Modra [Wed, 29 Jan 2014 21:56:02 +0000 (08:26 +1030)]
ppc476 icache bug workaround
This implements a work-around for an icache bug on 476 that can cause
execution of stale instructions when control falls through from one
page to the next. The idea is to prevent such fall-through by
replacing the last instruction on a page with a branch to a patch
area containing the instruction, then branch to the next page.
The patch also fixes a number of bugs in the existing support for long
branch trampolines.
bfd/
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add params.
Delete emit_stub_syms, no_tls_get_addr_opt. Update all uses.
(ppc_elf_link_params): New function.
(ppc_elf_create_glink): Align .glink to 64 bytes for ppc476
workaround.
(ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms
parameters. Use htab->params instead.
(ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter.
(ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to
64 bytes for ppc476 workaround.
(struct ppc_elf_relax_info): New.
(ppc_elf_relax_section): Exclude linker created sections and
those too small to hold one instruction. Don't add another
branch around trampolines on later relax passes. Don't
generate trampolines for undefined symbols when !relocatable,
nor for plugin symbols. Allocate space for ppc476 workaround
patch area. Free fixups on error return path.
(ppc_elf_relocate_section): Handle ppc476 workaround patching.
* elf32-ppc.h (struct ppc_elf_params): New.
(ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype.
(ppc_elf_link_params): Declare.
* section.c (SEC_INFO_TYPE_TARGET): Define.
* bfd-in2.h: Regenerate.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms)
plt_style): Delete. Adjust all refs to instead use..
(params): ..this. New variable.
(ppc_after_open_output): New function. Tweak params and pass to
ppc_elf_link_params.
(ppc_after_open): Adjust ppc_elf_select_plt_layout call.
(ppc_before_allocation): Adjust ppc_elf_tls_setup call. Enable
relaxation for ppc476 workaround.
(PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support.
(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
Alan Modra [Sun, 2 Feb 2014 23:00:43 +0000 (09:30 +1030)]
daily update
Sandra Loosemore [Sun, 2 Feb 2014 18:57:52 +0000 (10:57 -0800)]
Correct Nios II GOT pointer initialization.
2014-02-02 Sandra Loosemore <sandra@codesourcery.com>
bfd/
* elf32-nios2.c (struct elf32_nios2_link_hash_table): Add
h_gp_got field.
(nios2_elf32_relocate_section): Use got_base to adjust
GOT-pointer-relative relocations relative to _gp_got.
(create_got_section): Create _gp_got symbol.
(nios2_elf32_finish_dynamic_symbol): Make _gp_got absolute.
(nios2_elf32_size_dynamic_sections): Set _gp_got offset.
Sebastian Huber [Sun, 2 Feb 2014 14:39:39 +0000 (06:39 -0800)]
Fix ALIGN_WITH_INPUT
ld/
2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation.
* ld/ldlang.c (lang_size_sections_1): Add dotdelta
variable which reflects the VMA change due to alignment
requirements. Use dotdelta do change the LMA if
ALIGN_WITH_INPUT is requested.
ld/testsuite/ChangeLog
2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ld-scripts/rgn-at9.d: New file.
* ld-scripts/rgn-at9.t: Likewise.
* ld-scripts/rgn-at10.d: Likewise.
* ld-scripts/rgn-at10.s: Likewise.
* ld-scripts/rgn-at10.t: Likewise.
* ld-scripts/rgn-at11.d: Likewise.
* ld-scripts/rgn-at11.t: Likewise.