Commit Graph

80551 Commits

Author SHA1 Message Date
Doug Evans 1913f160bd * guile/scm-type.c (type_smob): Remove duplicate typedef. 2014-06-04 00:26:03 -07:00
Markus Metzger 70ad5bfff3 btrace: async support
Add support for async command execution.  This fixes the gdb.btrace tests.

	* record-btrace.c: Include event-loop.h and inf-loop.h.
	(record_btrace_resume_exec_dir)
	(record_btrace_async_inferior_event_handler)
	(record_btrace_handle_async_inferior_event): New.
	(record_btrace_open): Create async event handler.
	(record_btrace_close): Delete async event handler.
	(record_btrace_resume): Set record_btrace_resume_exec_dir,
	Mark async event handler.
	(record_btrace_execution_direction): New.
	(init_record_btrace_ops): Initialize to_execution_direction.
2014-06-04 09:09:21 +02:00
Hui Zhu 9f5a4cef68 Add system test before "set remote system-call-allowed 1" to fileio.exp
This patch is update version according to the discussion in
https://www.sourceware.org/ml/gdb-patches/2009-11/msg00090.html.
If test get the target doesn't support fileio system according to the
remote log.   It will set this test as "unsupported".

Before I made this patch, I want add a check before all of tests in this
file.  But I found that the target maybe support one call but not others.
For example: my target support Fwrite, Fopen and so on.  But not Fgettimeofday.
And it doesn't support Fsystem NULL but it support Fsystem not NULL.
So I think if we want to check target support fileio, we need check them
one by one.

2014-06-04  Nathan Sidwell  <nathan@codesourcery.com>
	    Hui Zhu  <hui@codesourcery.com>

	* gdb.base/fileio.exp: Add test for shell not available as well as
	available.
	* gdb.base/fileio.c (test_system): Check for shell twice.
2014-06-04 14:38:16 +08:00
Yao Qi 90a45c4d5f Fix a regexp pattern in gdb.base/auto-connect-native-target.exp
When I test gdb head (for 7.8 release) on arm-none-eabi, I find the
following this failure, which are caused by the improper regexp
pattern in the test.

(gdb) help target native^M
Undefined target command: "native".  Try "help target".^M
(gdb) FAIL: gdb.base/auto-connect-native-target.exp: help target native

The space in front of "$gdb_prompt $" looks redundant, and this patch
is to remove it from the regexp pattern.

gdb/testsuite:

2014-06-04  Yao Qi  <yao@codesourcery.com>

	* gdb.base/auto-connect-native-target.exp: Remove redundant
	space from the regexp pattern.
2014-06-04 13:30:44 +08:00
Yao Qi 70017e417c Fix regexp pattern in gdb.base/default.exp
I see this failure on arm-none-eabi gdb testing.

target native^M
Undefined target command: "native".  Try "help target".^M
(gdb) FAIL: gdb.base/default.exp: target native

This patch is to update the regexp pattern to match "native" instead of
"child".

gdb/testsuite:

2014-06-04  Yao Qi  <yao@codesourcery.com>

	* gdb.base/default.exp: Replace "child" with "native" in
	regexp pattern.
2014-06-04 13:30:39 +08:00
Doug Evans b6210538cf * guile/scm-param.c (pascm_make_param_smob): Add ARI comment.
(gdbscm_make_parameter): Ditto.
2014-06-03 20:37:56 -07:00
Alan Modra d03cec6e44 daily update 2014-06-04 09:30:43 +09:30
Doug Evans a5b1fd2780 resize_section_table cleanup
* exec.c (exec_close_1): Call clear_section_table instead of
	resize_section_table.
	(clear_section_table): New function.
	(resize_section_table): Make static.  Rename arg num_added to
	adjustment.
	* exec.h (clear_section_table): Declare.
	(resize_section_table): Delete.
	* progspace.c (release_program_space): Call clear_section_table
	instead of resize_section_table.
2014-06-03 13:48:12 -07:00
DJ Delorie 33ac0ca144 * elf32-rx.c (rx_table_map): Use BFD_VMA_FMT for portability. 2014-06-03 16:23:21 -04:00
Joel Brobecker 1e47491b33 gdb/doc/python.texi: Fix reference to "Progspaces In Python".
A recent change broke the documentation build due to a think-o
in a reference.  Fixed thusly.

gdb/doc/ChangeLog:

        * python.texi (Xmethod API): Fix reference to "Progspaces In
        Python".

Tested by rebuilding all documentation formats.
2014-06-03 10:41:17 -07:00
Siva Chandra 0c6e92a52c Documentation of the xmethod support in GDB Python API.
* NEWS (Python Scripting): Add entry about the new xmethods
	feature.

	doc/
	*  python.texi (Xmethods In Python, XMethod API)
	(Writing an Xmethod): New nodes.
	(Python API): New menu entries "Xmethods In Python",
	"Xmethod API", "Writing an Xmethod".
2014-06-03 10:07:45 -07:00
Siva Chandra 883964a75e Xmethod support in Python.
* python/py-xmethods.c: New file.
	* python/py-objfile.c (objfile_object): New field 'xmethods'.
	(objfpy_dealloc): XDECREF on the new xmethods field.
	(objfpy_new, objfile_to_objfile_object): Initialize xmethods
	field.
	(objfpy_get_xmethods): New function.
	(objfile_getset): New entry 'xmethods'.
	* python/py-progspace.c (pspace_object): New field 'xmethods'.
	(pspy_dealloc): XDECREF on the new xmethods field.
	(pspy_new, pspace_to_pspace_object): Initialize	xmethods
	field.
	(pspy_get_xmethods): New function.
	(pspace_getset): New entry 'xmethods'.
	* python/python-internal.h: Add declarations for new functions.
	* python/python.c (_initialize_python): Invoke
	gdbpy_initialize_xmethods.
	* python/lib/gdb/__init__.py (xmethods): New
	attribute.
	* python/lib/gdb/xmethod.py: New file.
	* python/lib/gdb/command/xmethods.py: New file.

	testuite/
	* gdb.python/py-xmethods.cc: New testcase to test xmethods.
	* gdb.python/py-xmethods.exp: New tests to test xmethods.
	* gdb.python/py-xmethods.py: Python script supporting the
	new testcase and tests.
2014-06-03 10:03:07 -07:00
Siva Chandra 58992dc550 Missed ChangeLog entry in the previous commit. 2014-06-03 09:56:58 -07:00
Siva Chandra 233e8b28cf Lookup and invoke debug methods of C++ classes if they are the best match.
* eval.c (evaluate_subexp_standard): Call the xmethod if the
	best match method returned by find_overload_match is an xmethod.
	* valarith.c (value_x_binop, value_x_unop): Call the xmethod if
	the best matching operator returned by find_overload_match is an
	xmethod.
	* valops.c: #include "extension.h".
	(find_method_list): Add "fn_list" and "xm_worker_vec" arguments.
	Return void.  The list of matching source methods is returned in
	"fn_list" and a vector of matching debug method workers is
	returned in "xm_worker_vec".  Update all callers.
	(value_find_oload_method_list): Likewise.
	(find_oload_champ): Add "xm_worker_vec" parameter.  If it is
	non-NULL, then the index of the best matching method in this
	vector is returned.  Update all callers.
	(find_overload_match): Include xmethods while performing overload
	resolution.
2014-06-03 09:54:21 -07:00
Siva Chandra e81e7f5e38 Add xmethod interface to the extension language API.
* defs.h (enum lval_type): New enumerator "lval_xcallable".
	* extension-priv.h (struct extension_language_ops): Add the
	xmethod interface.
	* extension.c (new_xmethod_worker, clone_xmethod_worker,
	get_matching_xmethod_workers, get_xmethod_argtypes,
	invoke_xmethod, free_xmethod_worker,
	free_xmethod_worker_vec): New functions.
	* extension.h: #include "common/vec.h".
	New function declarations.
	(struct xmethod_worker): New struct.
	(VEC (xmethod_worker_ptr)): New vector type.
	(xmethod_worker_ptr): New typedef.
	(xmethod_worker_vec): Likewise.
	* gdbtypes.c (gdbtypes_post_init): Initialize "xmethod" field of
	builtin_type.
	* gdbtypes.h (enum type_code): New enumerator TYPE_CODE_XMETHOD.
	(struct builtin_type): New field "xmethod".
	* valarith.c (value_ptradd): Assert that the value argument is not
	lval_xcallable.
	* valops.c (value_must_coerce_to_target): Return 0 for
	lval_xcallable values.
	* value.c (struct value): New field XM_WORKER in the field
	LOCATION.
	(value_address, value_raw_address): Return 0 for lval_xcallable
	values.
	(set_value_address): Assert that the value is not an
	lval_xcallable.
	(value_free): Free the associated xmethod worker when freeing
	lval_xcallable values.
	(set_value_component_location): Assert that the WHOLE value is not
	lval_xcallable.
	(value_of_xmethod, call_xmethod): New functions.
	* value.h: Declare "struct xmethod_worker".
	Declare new functions value_of_xmethod, call_xmethod.
2014-06-03 09:49:26 -07:00
Joel Brobecker ef370185fc User breakpoint ignored if software-single-step at same location
with the following code...

    12    Nested;   -- break #1
    13    return I; -- break #2
    14  end;

(line 12 is a call to function Nested)

... we have noticed the following errorneous behavior on ppc-aix,
where, after having inserted a breakpoint at line 12 and line 13,
and continuing from the breakpoint at line 12, the program never
stops at line 13, running away until the program terminates:

    % gdb -q func
    (gdb) b func.adb:12
    Breakpoint 1 at 0x10000a24: file func.adb, line 12.
    (gdb) b func.adb:13
    Breakpoint 2 at 0x10000a28: file func.adb, line 13.
    (gdb) run
    Starting program: /[...]/func

    Breakpoint 1, func () at func.adb:12
    12        Nested;   -- break #1
    (gdb) c
    Continuing.
    [Inferior 1 (process 4128872) exited with code 02]

When resuming from the first breakpoint, GDB first tries to step out
of that first breakpoint.  We rely on software single-stepping on this
platform, and it just so happens that the address of the first
software single-step breakpoint is the same as the user's breakpoint
#2 (0x10000a28).  So, with infrun and target traces turned on (but
uninteresting traces snip'ed off), the "continue" operation looks like
this:

    (gdb) c
    ### First, we insert the user breakpoints (the second one is an internal
    ### breakpoint on __pthread_init). The first user breakpoint is not
    ### inserted as we need to step out of it first.
    target_insert_breakpoint (0x0000000010000a28, xxx) = 0
    target_insert_breakpoint (0x00000000d03f3800, xxx) = 0
    ### Then we proceed with the step-out-of-breakpoint...
    infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process 15335610] at 0x10000a24
    ### That's when we insert the SSS breakpoints...
    target_insert_breakpoint (0x0000000010000a28, xxx) = 0
    target_insert_breakpoint (0x00000000100009ac, xxx) = 0
    ### ... then let the inferior resume...
    target_resume (15335610, continue, 0)
    infrun: wait_for_inferior ()
    target_wait (-1, status, options={}) = 15335610,   status->kind = stopped, signal = GDB_SIGNAL_TRAP
    infrun: target_wait (-1, status) =
    infrun:   15335610 [process 15335610],
    infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
    infrun: infwait_normal_state
    infrun: TARGET_WAITKIND_STOPPED
    infrun: stop_pc = 0x100009ac
    ### At this point, we stopped at the second SSS breakpoint...
    target_stopped_by_watchpoint () = 0
    ### We remove the SSS breakpoints...
    target_remove_breakpoint (0x0000000010000a28, xxx) = 0
    target_remove_breakpoint (0x00000000100009ac, xxx) = 0
    target_stopped_by_watchpoint () = 0
    ### We find that we're not done, so we resume....
    infrun: no stepping, continue
    ### And thus insert the user breakpoints again, except we're not
    ### inserting the second breakpoint?!?
    target_insert_breakpoint (0x0000000010000a24, xxx) = 0
    infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 15335610] at 0x100009ac
    target_resume (-1, continue, 0)
    infrun: prepare_to_wait
    target_wait (-1, status, options={}) = 15335610,   status->kind = exited, status = 2

What happens is that the removal of the software single-step
breakpoints effectively removed the breakpoint instruction from
inferior memory.  But because such breakpoints are inserted directly
as raw breakpoints rather than through the normal chain of
breakpoints, we fail to notice that one of the user breakpoints points
to the same address and that this user breakpoint is therefore
effectively un-inserted.  When resuming after the single-step, GDB
thinks that the user breakpoint is still inserted and therefore does
not need to insert it again.

This patch teaches the insert and remove routines of both regular and
raw breakpoints to be aware of each other.  Special care needs to be
applied in case the target supports evaluation of breakpoint
conditions or commands.

gdb/ChangeLog:

	PR breakpoints/17000
	* breakpoint.c (find_non_raw_software_breakpoint_inserted_here):
	New function, extracted from software_breakpoint_inserted_here_p.
	(software_breakpoint_inserted_here_p): Replace factored out code
	by call to find_non_raw_software_breakpoint_inserted_here.
	(bp_target_info_copy_insertion_state): New function.
	(bkpt_insert_location): Handle the case of a single-step
	breakpoint already inserted at the same address.
	(bkpt_remove_location): Handle the case of a single-step
	breakpoint still inserted at the same address.
	(deprecated_insert_raw_breakpoint): Handle the case of non-raw
	breakpoint already inserted at the same address.
	(deprecated_remove_raw_breakpoint): Handle the case of a
	non-raw breakpoint still inserted at the same address.
	(find_single_step_breakpoint): New function, extracted from
	single_step_breakpoint_inserted_here_p.
	(find_single_step_breakpoint): New function,
	factored out from single_step_breakpoint_inserted_here_p.
	(single_step_breakpoint_inserted_here_p): Reimplement.

gdb/testsuite/ChangeLog:

	PR breakpoints/17000
	* gdb.base/sss-bp-on-user-bp.exp: Remove kfail.
	* gdb.base/sss-bp-on-user-bp-2.exp: Remove kfail.

Tested on ppc-aix with AdaCore's testsuite.  Tested on x86_64-linux,
(native and gdbserver) with the official testsuite.  Also tested on
x86_64-linux through Pedro's branch enabling software single-stepping
on that platform (native and gdbserver).
2014-06-03 17:42:19 +01:00
Nick Clifton c32abae845 This is to fix a further problem with merging resource sections. It turns
out that the section is supposed to be page-aligned, but the newly merged
section was not being padded out to a page boundary.  This meant that when
the executable was stripped a badly sized .rsrc section was written out.

	PR ld/16807
	* peXXigen.c (rsrc_process_section): Page align the new contents
	befgore writing out.
2014-06-03 17:18:27 +01:00
Brad Mouring 1e2ccb612d gdb/source.c: Fix matching path substitute rule listing
The check for the source (or "from") directory snippet in listing
matching path substitution rules currently will not match anything
other than a direct match of the "from" field in a substitution rule,
resulting in the incorrect behavior below:

...
(gdb) set substitute-path /a/path /another/path
(gdb) show substitute-path
List of all source path substitution rules:
  `/a/path' -> `/another/path'.
(gdb) show substitute-path /a/path/to/a/file.ext
Source path substitution rule matching `/a/path/to/a/file.ext':
(gdb) show substitute-path /a/path
Source path substitution rule matching `/a/path':
  `/a/path' -> `/another/path'.
...

This change effects the following behavior by (sanely) checking
with the length of the "from" portion of a rule and ensuring that
the next character of the path considered for substitution is a path
delimiter (or NULL). With this change, the following behavior is
garnered:
...
(gdb) set substitute-path /a/path /another/path
(gdb) show substitute-path
List of all source path substitution rules:
  `/a/path' -> `/another/path'.
(gdb) show substitute-path /a/path/to/a/file.ext
Source path substitution rule matching `/a/path/to/a/file.ext':
  `/a/path' -> `/another/path'.
(gdb) show substitute-path /a/pathological/case/that/should/fail.err
Source path substitution rule matching `/a/pathological/case/that/should/fail.err':
(gdb)

Also included is a couple of tests added to subst.exp to verify
this behavior in the test suite.

gdb/ChangeLog:

        * source.c (show_substitute_path_command): Fix display of matching
        substitution rules.

gdb/testsuite/ChangeLog:

        * gdb.ada/subst.exp: Add tests to verify partial path matching
        output.

This was tested on x86_64 Linux.
2014-06-03 07:17:06 -07:00
Pedro Alves c6ec5ab23a Skip sss-bp-on-user-bp-2.exp on remote hardware step targets.
gdb/testsuite/
2014-06-03  Pedro Alves  <palves@redhat.com>

	* gdb.base/sss-bp-on-user-bp-2.exp: Skip if testing with a remote
	target that doesn't use software single-stepping.
2014-06-03 14:04:48 +01:00
Gary Benson d3448d8523 This patch replaces a call to cplus_demangle with a call to
gdb_demangle.  This change was included in an RFC from last
March [1] but omitted from the eventual commit.

[1] https://sourceware.org/ml/gdb-patches/2013-03/msg00235.html

2014-06-03  Gary Benson  <gbenson@redhat.com>

	* gnu-v2-abi.c (gnuv2_value_rtti_type): Use gdb_demangle.
2014-06-03 13:49:20 +01:00
Pedro Alves 835c559fd5 PR breakpoints/17000: user breakpoint not inserted if software-single-step at same location - test
GDB gets confused when removing a software single-step breakpoint that
is at the same address as another breakpoint.  Add another kfailed
test.

gdb/testsuite/
2014-06-03  Pedro Alves  <palves@redhat.com>

	PR breakpoints/17000
	* gdb.base/sss-bp-on-user-bp-2.c: New file.
	* gdb.base/sss-bp-on-user-bp-2.exp: New file.
2014-06-03 12:46:46 +01:00
Doug Evans 06eb158633 Add parameter support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-param.o.
	(SUBDIR_GUILE_SRCS): Add scm-param.c.
	(scm-param.o): New rule.
	* guile/guile-internal.h (gdbscm_gc_dup_argv): Declare.
	(gdbscm_misc_error): Declare.
	(gdbscm_canonicalize_command_name): Declare.
	(gdbscm_scm_to_host_string): Declare.
	(gdbscm_scm_from_host_string): Declare.
	(gdbscm_initialize_parameters): Declare.
	* guile/guile.c (initialize_gdb_module): Call
	gdbscm_initialize_parameters.
	* guile/lib/gdb.scm: Export parameter symbols.
	* guile/scm-cmd.c (gdbscm_canonicalize_command_name): Renamed from
	cmdscm_canonicalize_name and made public.  All callers updated.
	* guile/scm-exception.c (gdbscm_misc_error): New function.
	* guile/scm-param.c: New file.
	* guile/scm-string.c (gdbscm_scm_to_string): Add comments.
	(gdbscm_scm_to_host_string): New function.
	(gdbscm_scm_from_host_string): New function.
	* scm-utils.c (gdbscm_gc_dup_argv): New function.

	testsuite/
	* gdb.guile/scm-parameter.exp: New file.

	doc/
	* guile.texi (Guile API): Add entry for Parameters In Guile.
	(GDB Scheme Data Types): Mention <gdb:parameter> object.
	(Parameters In Guile): New node.
2014-06-03 01:58:15 -07:00
Nick Clifton aef392c4ae Fix a small but in the emulation of the MSP430 hardware multiply.
* msp430-sim.c (get_op): Handle reads of low result register when
	in MAC mode.
	(put_op): Copy MAC result into result words.
	Handle writes to the low result register.
2014-06-03 09:00:57 +01:00
Nick Clifton 9f44512958 Fix the disassembly of MSP430 extended index addressing mode.
* msp430-dis.c (msp430_doubleoperand): Use extension_word to
	decide when extended addressing is being used.
2014-06-03 08:54:04 +01:00
Nick Clifton 69227609dc Change -mz command line option to -my for the MSP430 port of GAS.
* config/tc-msp430.c (OPTION_WARN_INTR_NOPS): Use y instead of z.
	(OPTION_NO_WARN_INTR_NOPS): Use Y instead of Z.
	* doc/c-msp430.texi: Update command line option description.

	* gas/msp430/bad.d: Use -my not -mz.
2014-06-03 08:49:02 +01:00
Nick Clifton 9bc24099c8 If the binutils testsuite is run on an installed toolchain the tests involving
the bfdtest1 and bfdtest2 executables will fail because they are not installed.
 Since the programs only exist to be used by the testsuite it does not make sense
to install them, so instead I have chosen to create a patch which skips the tests
when they are not present.

	* binutils-all/ar.exp: Skip tests involving bfdtest1 and bfdtest2
	if these executables are not present.
2014-06-03 08:40:39 +01:00
Doug Evans e698b8c41c Add command support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-cmd.o.
	(SUBDIR_GUILE_SRCS): Add scm-cmd.c.
	(scm-cmd.o): New rule.
	* guile/guile-internal.h (gdbscm_gc_xstrdup): Declare.
	(gdbscm_user_error_p): Declare.
	(gdbscm_parse_command_name): Declare.
	(gdbscm_valid_command_class_p): Declare.
	(gdbscm_initialize_commands): Declare.
	* guile/guile.c (initialize_gdb_module): Call
	gdbscm_initialize_commands.
	* guile/lib/gdb.scm: Export command symbols.
	* guile/lib/gdb/init.scm (%exception-keys): Add gdb:user-error.
	(throw-user-error): New function.
	* guile/scm-cmd.c: New file.
	* guile/scm-exception.c (user_error_symbol): New static global.
	(gdbscm_user_error_p): New function.
	(gdbscm_initialize_exceptions): Set user_error_symbol.
	* scm-utils.c (gdbscm_gc_xstrdup): New function.

	testsuite/
	* gdb.guile/scm-cmd.c: New file.
	* gdb.guile/scm-cmd.exp: New file.

	doc/
	* guile.texi (Guile API): Add entry for Commands In Guile.
	(Basic Guile) <parse-and-eval>: Add reference.
	(Basic Guile) <string->argv>: Move definition to Commands In Guile.
	(GDB Scheme Data Types): Mention <gdb:command> object.
	(Commands In Guile): New node.
2014-06-03 00:29:49 -07:00
Phil Muldoon fb1f94b09a Don't remove #-comments.
When using the multi-line feature, we don't want the gdb CLI to remove
comments from the command list, as this will remove things like
"#define".

	* top.c (command_loop): Handle comments here...
	(command_line_input): ... not here.
2014-06-03 00:01:39 -07:00
Doug Evans ded0378278 Add progspace support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-progspace.o.
	(SUBDIR_GUILE_SRCS): Add scm-progspace.c.
	(scm-progspace.o): New rule.
	* guile/guile-internal.h (pspace_smob): New typedef.
	(psscm_pspace_smob_pretty_printers): Declare.
	(psscm_pspace_smob_from_pspace): Declare.
	(psscm_scm_from_pspace): Declare.
	* guile/guile.c (initialize_gdb_module): Call
	gdbscm_initialize_pspaces.
	* guile/lib/gdb.scm: Export progspace symbols.
	* guile/lib/gdb/printing.scm (prepend-pretty-printer!): Add progspace
	support.
	(append-pretty-printer!): Ditto.
	* guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_progspace):
	Implement.
	* guile/scm-progspace.c: New file.

	doc/
	* guile.texi (Guile API): Add entry for Progspaces In Guile.
	(GDB Scheme Data Types): Mention <gdb:progspace> object.
	(Progspaces In Guile): New node.

	testsuite/
	* gdb.guile/scm-pretty-print.exp: Add tests for objfile and progspace
	pretty-printer lookup.
	* gdb.guile/scm-pretty-print.scm (pp_s-printer): New function.
	(make-pp_s-printer): Call it.
	(make-pretty-printer-from-dict): New function.
	(lookup-pretty-printer-maker-from-dict): New function.
	(*pretty-printer*): Simplify.
	(make-objfile-pp_s-printer): New function.
	(install-objfile-pretty-printers!): New function.
	(make-progspace-pp_s-printer): New function.
	(install-progspace-pretty-printers!): New function.
	* gdb.guile/scm-progspace.c: New file.
	* gdb.guile/scm-progspace.exp: New file.
2014-06-02 23:46:27 -07:00
Alan Modra 397998fc32 Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld.  Thus
    addis r12,r2,xxx@ha
    addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
    addis r11,r2,xxx@ha
    addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.

bfd/
	* elf64-ppc.c (ADDIS_R12_R2): Define.
	(build_plt_stub): Support fusion on ELFv2 stub.
	(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
	* powerpc.cc (addis_12_2): Define.
	(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
	* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
	* ppc64-tdep.c (ppc64_standard_linkage8): New.
	(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 10:55:29 +09:30
Alan Modra 61f5c66f62 Fix gold plugin_test failures on PowerPC64 ELFv2
readelf output for ELFv2 includes st_other bits specifying a
function's local entry offset.

	* testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
	st_other output.
2014-06-03 10:47:55 +09:30
Doug Evans 6aa5f3a6ed Add support for skeletonless type units.
* dwarf2read.c (struct dwarf2_per_objfile): New member
	n_allocated_type_units.
	(struct dwarf2_per_objfile) <tu_stats>: New member
	nr_all_type_units_reallocs.
	(create_signatured_type_table_from_index): Initialize
	n_allocated_type_units
	(create_all_type_units): Ditto.
	(add_type_unit): Move up in file.  New arg slot.
	All callers updated.  Increase space for all_type_units more
	efficiently.
	(fill_in_sig_entry_from_dwo_entry): Handle psymtabs.
	(lookup_dwo_signatured_type): Handle skeletonless TUs.
	(lookup_dwp_signatured_type): Ditto.
	(init_tu_and_read_dwo_dies): New arg use_existing_cu.
	All callers updated.
	(build_type_psymtabs_1): Leave type_unit_groups as
	NULL if no TUs present.
	(print_tu_stats): New function.
	(process_skeletonless_type_unit): New function.
	(process_dwo_file_for_skeletonless_type_units): New
	function.
	(process_skeletonless_type_units): New function.
	(dwarf2_build_psymtabs_hard): Handle skeletonless TUs.
	Call print tu_stats if debugging enabled.
2014-06-02 17:16:07 -07:00
Alan Modra f70b8a9ba2 daily update 2014-06-03 09:31:13 +09:30
Pedro Alves 41fac0cf49 Installing a breakpoint on top of a dprintf makes GDB lose control.
While the full fix for PR 15180 isn't in, it's best if we at least
make sure that GDB doesn't lose control when a breakpoint is set at
the same address as a dprintf.

gdb/
2014-06-02  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (build_target_command_list): Don't build a command
	list if we have any duplicate location that isn't a dprintf.

gdb/testsuite/
2014-06-02  Pedro Alves  <palves@redhat.com>

	* gdb.base/dprintf-bp-same-addr.c: New file.
	* gdb.base/dprintf-bp-same-addr.exp: New file.
2014-06-02 23:29:13 +01:00
Pedro Alves cd1608cc4e dprintf-style agent can't explain a trap.
If some event happens to trigger at the same address as a dprintf-style
agent dprintf is installed, GDB will complain, like:

 (gdb) continue
 Continuing.
 May only run agent-printf on the target
 (gdb)

Such dprintfs are completely handled on the target side, so they can't
explain a stop, but GDB is currently putting then on the bpstat chain
anyway, because they currently unconditionally use bkpt_breakpoint_hit
as breakpoint_hit method.

gdb/
2014-06-02  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (dprintf_breakpoint_hit): New function.
	(initialize_breakpoint_ops): Install it as dprintf's
	breakpoint_hit method.
2014-06-02 23:28:54 +01:00
Pedro Alves 0a261ed82e gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.
If GDB decides to change the breakpoint's conditions or commands,
it'll reinsert the same breakpoint again, with the new options
attached, without deleting the previous breakpoint.  E.g.,

 (gdb) set breakpoint always-inserted on
 (gdb) b main if 0
 Breakpoint 1 at 0x400594: file foo.c, line 21.
 Sending packet: $Z0,400594,1;X3,220027#68...Packet received: OK
 (gdb) b main
 Breakpoint 15 at 0x400594: file foo.c, line 21.
 Sending packet: $Z0,400594,1#49...Packet received: OK

GDBserver understands this and deletes the breakpoint's previous
conditions.  But, it forgets to delete the previous commands.

gdb/gdbserver/
2014-06-02  Pedro Alves  <palves@redhat.com>

	* ax.c (gdb_free_agent_expr): New function.
	* ax.h (gdb_free_agent_expr): New declaration.
	* mem-break.c (delete_gdb_breakpoint_1): Also clear the commands
	list.
	(clear_breakpoint_conditions, clear_breakpoint_commands): Make
	static.
	(clear_breakpoint_conditions_and_commands): New function.
	* mem-break.h (clear_breakpoint_conditions): Delete declaration.
	(clear_breakpoint_conditions_and_commands): New declaration.
2014-06-02 22:27:32 +01:00
Edjunior Barbosa Machado 96ae5695ce gdb/testsuite/
2014-06-02  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* gdb.arch/powerpc-power.exp: Add power8 instructions to the testcase.
	* gdb.arch/powerpc-power.s: Likewise.
2014-06-02 13:57:27 -03:00
Joel Brobecker da02b3a81f Unnecessary restore of timeout global at end of gdb.base/completion.exp
This patch removes some code in gdb.base/compilation.exp which
is aimed at restoring the original timeout global value after having
changed it for this testcase. Restoring the timeout global is not
necessary as this is taken care of by gdb_init, which is called
at the start of each testing.

gdb/testsuite/ChangeLog:

        * gdb.base/completion.exp: Remove code aimed at restoring TIMEOUT.
2014-06-02 08:42:30 -07:00
Joel Brobecker 486ef3b933 simplify substitute_path_rule_matches using filename_ncmp
At the time this function was written, there was no filename_ncmp,
only FILENAME_CMP. So, in order to do an n-cmp, we had to make a local
copy of the first n characters of our string and use that to perform
the comparison. This patch simplifies the function's implementation,
now that we have filename_ncmp.

gdb/ChangeLog:

        * source.c (substitute_path_rule_matches): Simplify using
        filename_ncmp instead of FILENAME_CMP.

Tested on x86_64-linux.
2014-06-02 08:39:02 -07:00
Joel Brobecker 230cd560c8 Remove some trailing spaces in source.c
gdb/ChangeLog:

        * source.c (substitute_path_rule_matches): Remove trailing spaces.
2014-06-02 08:38:21 -07:00
Eric Botcazou ec9a8169c3 This fixes a thinko in the LEON support recently added to the assembler.
opcodes/
	* sparc-opc.c (cas): Disable for LEON.
	(casl): Likewise.
2014-06-02 13:11:17 +02:00
Alan Modra ab251b8980 fix typos in ChangeLog 2014-06-02 15:59:21 +09:30
Alan Modra ce46249c15 fix 2014-05-28 ld Makefile.am changes
bfin, msp, and score all used an extra parameter to genscripts.sh
to select a "customizer_script" different from the standard one
named from the emulation.  This patch renames the scripts to avoid
the need, tidying them in the process.

	* emulparams/elf32bfin.sh: Rename from bfin.sh.
	* emulparams/elf32bfinfd.sh: Update to suit.
	* emulparams/: Delete.
	* emulparams/msp430.sh: Rename from msp430all.sh.  Remove
	MSP430_NAME and msp430X vars.
	* emulparams/msp430X.sh: New.
	* emulparams/: Delete.
	* emulparams/score3_elf.sh: Rename from scoreelf.sh.  Remove
	SCORE_NAME and score7_elf ARCH setting.
	* emulparams/score7_elf.sh: New.
	* Makefile.am (eelf32bfin.c, eelf32bfinfd.c): Update dependencies.
	(emsp430.c, emsp430X.c, escore3_elf.c, escore7_elf.c): Likewise.
	* Makefile.in: Regenerate.
	* genscripts.sh: Delete customizer_script param.
2014-06-02 14:52:52 +09:30
Alan Modra ad7cf460ea daily update 2014-06-02 09:30:41 +09:30
Alan Modra f697178787 Fix PowerPC64 ELFv2 icf_safe failures
ELFv2 doesn't use .opd, so folding function code can't be allowed
in safe mode if a function's address might be taken.

	* powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
	Only ignore relocs on ELFv1.
	(Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2014-06-02 09:26:23 +09:30
Ludovic Courtès 16954d5d9d guile: Allow compilation with Guile <= 2.0.5.
gdb/
2014-06-01  Ludovic Courtès  <ludo@gnu.org>

	* configure.ac: When Guile is available, check for the
	availability of 'scm_new_smob'.
	* configure, config.h.in: Regenerate.
	* guile/guile-internal.h (scm_new_smob) [!HAVE_SCM_NEW_SMOB]: New
	function.
2014-06-01 22:26:55 +02:00
Kai Tietz f69123aac5 2014-06-01 Ray Donnelly <mingw.android@gmail.com>
* pex-win32.c (argv_to_cmdline): Don't quote
	args unnecessarily.
2014-06-01 22:11:56 +02:00
Yao Qi c72b2e7b2f Skip test 'watch -location nullptr->p->x' if null pointer can be dereferenced
gdb.base/watchpoint.exp has a test below which expects to see "Cannot
access memory at address 0x0" when a null pointer is dereferenced.

    gdb_test "watch -location nullptr->p->x" \
	"Cannot access memory at address 0x0"

This assumption is not true when the target is no-mmu, so we get

watch -location nullptr->p->x
Hardware watchpoint 28: -location nullptr->p->x
(gdb) FAIL: gdb.base/watchpoint.exp: watch -location nullptr->p->x

This patch is to check whether null pointer can be dereferenced first
and then do the test.

gdb/testsuite:

2014-06-01  Yao Qi  <yao@codesourcery.com>

	* gdb.base/watchpoint.exp (test_watch_location): Check null
	pointer can be dereferenced.  If not, do the test, otherwise
	skip it.
2014-06-01 11:46:39 +08:00
Alan Modra 11b28b91b2 daily update 2014-06-01 09:30:39 +09:30
Alan Modra 394438f7dd daily update 2014-05-31 09:30:42 +09:30