binutils-gdb.git
10 years agodaily update
Alan Modra [Thu, 5 Jun 2014 00:01:07 +0000 (09:31 +0930)]
daily update

10 years agogdbserver crash if the_target->supports_z_point_type is NULL
Joel Brobecker [Wed, 4 Jun 2014 18:03:22 +0000 (14:03 -0400)]
gdbserver crash if the_target->supports_z_point_type is NULL

When debugging on LynxOS targets (and probably on SPU targets as well),
inserting a breakpoint and resuming the program's execution causes
GDBserver to crash.

The crash occurs while handling the Z0 packet sent by GDB to insert
our breakpoint, because z_type_supported calls
the_target->supports_z_point_type without checking that it is not NULL
This patch fixes the issue by making z_type_supported return false if
the_target->supports_z_point_type is NULL.

gdb/gdbserver/ChangeLog:

        PR server/17023
        * mem-break.c (z_type_supported): Return zero if
        THE_TARGET->SUPPORTS_Z_POINT_TYPE is NULL.

Tested on ppx-lynx5.

10 years agohandle VLA in a struct or union
Tom Tromey [Thu, 8 May 2014 17:26:44 +0000 (11:26 -0600)]
handle VLA in a struct or union

It is valid in GNU C to have a VLA in a struct or union type, but gdb
did not handle this.

This patch adds support for these cases in the obvious way.

Built and regtested on x86-64 Fedora 20.
New tests included.

2014-06-04  Tom Tromey  <tromey@redhat.com>

* ada-lang.c (ada_template_to_fixed_record_type_1): Use
value_from_contents_and_address_unresolved.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_which_variant_applies): Likewise.
* value.h (value_from_contents_and_address_unresolved): Declare.
* value.c (value_from_contents_and_address_unresolved): New
function.
* gdbtypes.c (is_dynamic_type, resolve_dynamic_type)
<TYPE_CODE_STRUCT, TYPE_CODE_UNION>: New cases.
(resolve_dynamic_struct, resolve_dynamic_union): New functions.

2014-06-04  Tom Tromey  <tromey@redhat.com>

* gdb.base/vla-datatypes.exp: Add tests for VLA-in-structure and
VLA-in-union.
* gdb.base/vla-datatypes.c (vla_factory): Add vla_struct,
inner_vla_struct, vla_union types.  Initialize objects of those
types and compute their sizes.

10 years agominor cleanups in is_dynamic_type
Tom Tromey [Thu, 8 May 2014 16:10:43 +0000 (10:10 -0600)]
minor cleanups in is_dynamic_type

I noticed that gdbtypes.c:is_dynamic_type has some unneeded "break"s.
This patch cleans up the function a bit, removing those and removing
the switch's default case so that the end of the function is a bit
clearer.

2014-06-04  Tom Tromey  <tromey@redhat.com>

* gdbtypes.c (is_dynamic_type): Remove unneeded "break"s.

10 years agoconstify to_attach
Tom Tromey [Mon, 15 Apr 2013 15:40:57 +0000 (09:40 -0600)]
constify to_attach

This constifies the "args" argument to the target_ops to_attach
method.

I updated all instances of the method.  I could not compile all of
them but I hand-inspected them.  In all cases either the argument is
ignored, or it is passed to parse_pid_to_attach.  (linux-nat does some
extra stuff, but that one I built...)

If you want to try it on your host of choice, please do so.

The code in parse_pid_to_attach seems a little bogus to me.  If there
is a platform with a broken strtoul, we have better methods for fixing
the issue now.  However, I left the code as is since it is clearly ok
to do so.

Built and regtested on x86-64 Fedora 20.

2014-06-04  Tom Tromey  <tromey@redhat.com>

* procfs.c (procfs_attach): Make "args" const.
* windows-nat.c (windows_attach): Make "args" const.
* nto-procfs.c (procfs_attach): Make "args" const.
* inf-ttrace.c (inf_ttrace_attach): Make "args" const.
* go32-nat.c (go32_attach): Make "args" const.
* gnu-nat.c (gnu_attach): Make "args" const.
* darwin-nat.c (darwin_attach): Make "args" const.
* inf-ptrace.c (inf_ptrace_attach): Make "args" const.
* linux-nat.c (linux_nat_attach): Make "args" const.
* remote.c (extended_remote_attach_1, extended_remote_attach):
Make "args" const.
* target.h (struct target_ops) <to_attach>: Make "args" const.
(find_default_attach): Likewise.
* utils.c (parse_pid_to_attach): Make "args" const.
* utils.h (parse_pid_to_attach): Update.

10 years agoconvert to_thread_address_space to use TARGET_DEFAULT_FUNC
Tom Tromey [Fri, 21 Feb 2014 17:33:42 +0000 (10:33 -0700)]
convert to_thread_address_space to use TARGET_DEFAULT_FUNC

This converts to_thread_address_space to use TARGET_DEFAULT_FUNC.

This method was one of a handful not using the normal target
delegation approach.  The only rationale here is consistency in the
target vector.

Built and regtested on x86-64 Fedora 20.

2014-06-04  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (default_thread_address_space): New function.
(target_thread_address_space): Simplify.
* target.h (struct target_ops) <to_thread_address_space>: Add
TARGET_DEFAULT_FUNC.

10 years agoTweak sss-bp-on-user-bp.exp
Yao Qi [Wed, 4 Jun 2014 05:03:19 +0000 (13:03 +0800)]
Tweak sss-bp-on-user-bp.exp

sss-bp-on-user-bp.c has an assumption that write to integer can be
compiled to a single instruction, which isn't true on some arch, such
as arm.  This test requires setting two breakpoints on two consecutive
instructions, so this patch is to get the address of the next
instruction via disassemble and set the 2nd breakpoint there.  This
approach is portable.

This patch fixes the fails in sss-bp-on-user-bp.exp on arm-none-abi
target.  There is no change in x86 test results.  I also revert the
patch to PR breakpoints/17000, and verified that the patched
sss-bp-on-user-bp.exp still trigger the fail on
x86-with-software-single-step.

gdb/testsuite:

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

* gdb.base/sss-bp-on-user-bp.c (main): Remove comments.
* gdb.base/sss-bp-on-user-bp.exp: Don't set breakpoint on
"set bar break here".  Get the next instruction address and
set breakpoint there.  Remove "bar break" from the regexp
patterns.

10 years agobfd/elfnn-aarch64.c: Cleanup a couple of TLS functions
Will Newton [Wed, 21 May 2014 15:49:57 +0000 (16:49 +0100)]
bfd/elfnn-aarch64.c: Cleanup a couple of TLS functions

Add an assert and remove an unused line of code.

bfd/ChangeLog:

2014-06-04  Will Newton  <will.newton@linaro.org>

        * elfnn-aarch64.c (tpoff_base): Make test of tls_sec
being non-NULL into an assert.
(elfNN_aarch64_tls_relax): Remove unused code.

10 years ago* guile/scm-type.c (type_smob): Remove duplicate typedef.
Doug Evans [Wed, 4 Jun 2014 07:26:03 +0000 (00:26 -0700)]
* guile/scm-type.c (type_smob): Remove duplicate typedef.

10 years agobtrace: async support
Markus Metzger [Mon, 2 Jun 2014 08:25:44 +0000 (10:25 +0200)]
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.

10 years agoAdd system test before "set remote system-call-allowed 1" to fileio.exp
Hui Zhu [Wed, 4 Jun 2014 06:37:34 +0000 (14:37 +0800)]
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.

10 years agoFix a regexp pattern in gdb.base/auto-connect-native-target.exp
Yao Qi [Tue, 3 Jun 2014 05:20:56 +0000 (13:20 +0800)]
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.

10 years agoFix regexp pattern in gdb.base/default.exp
Yao Qi [Tue, 3 Jun 2014 05:17:42 +0000 (13:17 +0800)]
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.

10 years ago * guile/scm-param.c (pascm_make_param_smob): Add ARI comment.
Doug Evans [Wed, 4 Jun 2014 03:37:56 +0000 (20:37 -0700)]
* guile/scm-param.c (pascm_make_param_smob): Add ARI comment.
(gdbscm_make_parameter): Ditto.

10 years agodaily update
Alan Modra [Wed, 4 Jun 2014 00:00:43 +0000 (09:30 +0930)]
daily update

10 years agoresize_section_table cleanup
Doug Evans [Tue, 3 Jun 2014 20:48:12 +0000 (13:48 -0700)]
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.

10 years ago* elf32-rx.c (rx_table_map): Use BFD_VMA_FMT for portability.
DJ Delorie [Tue, 3 Jun 2014 20:23:21 +0000 (16:23 -0400)]
* elf32-rx.c (rx_table_map): Use BFD_VMA_FMT for portability.

10 years agogdb/doc/python.texi: Fix reference to "Progspaces In Python".
Joel Brobecker [Tue, 3 Jun 2014 17:39:03 +0000 (10:39 -0700)]
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.

10 years agoDocumentation of the xmethod support in GDB Python API.
Siva Chandra [Sun, 30 Mar 2014 23:24:50 +0000 (16:24 -0700)]
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".

10 years agoXmethod support in Python.
Siva Chandra [Tue, 20 May 2014 13:53:04 +0000 (06:53 -0700)]
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.

10 years agoMissed ChangeLog entry in the previous commit.
Siva Chandra [Tue, 3 Jun 2014 16:56:58 +0000 (09:56 -0700)]
Missed ChangeLog entry in the previous commit.

10 years agoLookup and invoke debug methods of C++ classes if they are the best match.
Siva Chandra [Tue, 20 May 2014 13:41:39 +0000 (06:41 -0700)]
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.

10 years agoAdd xmethod interface to the extension language API.
Siva Chandra [Tue, 20 May 2014 13:30:29 +0000 (06:30 -0700)]
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.

10 years agoUser breakpoint ignored if software-single-step at same location
Joel Brobecker [Tue, 3 Jun 2014 16:42:19 +0000 (17:42 +0100)]
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).

10 years agoThis is to fix a further problem with merging resource sections. It turns
Nick Clifton [Tue, 3 Jun 2014 16:18:27 +0000 (17:18 +0100)]
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.

10 years agogdb/source.c: Fix matching path substitute rule listing
Brad Mouring [Mon, 2 Jun 2014 20:55:10 +0000 (15:55 -0500)]
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.

10 years agoSkip sss-bp-on-user-bp-2.exp on remote hardware step targets.
Pedro Alves [Tue, 3 Jun 2014 13:04:48 +0000 (14:04 +0100)]
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.

10 years agoThis patch replaces a call to cplus_demangle with a call to
Gary Benson [Tue, 3 Jun 2014 12:49:20 +0000 (13:49 +0100)]
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.

10 years agoPR breakpoints/17000: user breakpoint not inserted if software-single-step at same...
Pedro Alves [Tue, 3 Jun 2014 11:46:46 +0000 (12:46 +0100)]
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.

10 years agoAdd parameter support for Guile.
Doug Evans [Tue, 3 Jun 2014 08:58:15 +0000 (01:58 -0700)]
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.

10 years agoFix a small but in the emulation of the MSP430 hardware multiply.
Nick Clifton [Tue, 3 Jun 2014 08:00:57 +0000 (09:00 +0100)]
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.

10 years agoFix the disassembly of MSP430 extended index addressing mode.
Nick Clifton [Tue, 3 Jun 2014 07:54:04 +0000 (08:54 +0100)]
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.

10 years agoChange -mz command line option to -my for the MSP430 port of GAS.
Nick Clifton [Tue, 3 Jun 2014 07:49:02 +0000 (08:49 +0100)]
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.

10 years ago If the binutils testsuite is run on an installed toolchain the tests involving
Nick Clifton [Tue, 3 Jun 2014 07:37:29 +0000 (08:37 +0100)]
 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.

10 years agoAdd command support for Guile.
Doug Evans [Tue, 3 Jun 2014 07:29:49 +0000 (00:29 -0700)]
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.

10 years agoDon't remove #-comments.
Phil Muldoon [Tue, 3 Jun 2014 07:01:39 +0000 (00:01 -0700)]
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.

10 years agoAdd progspace support for Guile.
Doug Evans [Tue, 3 Jun 2014 06:46:27 +0000 (23:46 -0700)]
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.

10 years agoSupport fusion for ELFv2 stubs
Alan Modra [Tue, 3 Jun 2014 01:25:29 +0000 (10:55 +0930)]
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.

10 years agoFix gold plugin_test failures on PowerPC64 ELFv2
Alan Modra [Tue, 3 Jun 2014 01:17:55 +0000 (10:47 +0930)]
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.

10 years agoAdd support for skeletonless type units.
Doug Evans [Tue, 3 Jun 2014 00:16:07 +0000 (17:16 -0700)]
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.

10 years agodaily update
Alan Modra [Tue, 3 Jun 2014 00:01:13 +0000 (09:31 +0930)]
daily update

10 years agoInstalling a breakpoint on top of a dprintf makes GDB lose control.
Pedro Alves [Mon, 2 Jun 2014 21:27:33 +0000 (22:27 +0100)]
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.

10 years agodprintf-style agent can't explain a trap.
Pedro Alves [Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)]
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.

10 years agogdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.
Pedro Alves [Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)]
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.

10 years agogdb/testsuite/
Edjunior Barbosa Machado [Mon, 2 Jun 2014 16:57:27 +0000 (13:57 -0300)]
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.

10 years agoUnnecessary restore of timeout global at end of gdb.base/completion.exp
Joel Brobecker [Tue, 27 May 2014 21:03:11 +0000 (14:03 -0700)]
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.

10 years agosimplify substitute_path_rule_matches using filename_ncmp
Joel Brobecker [Mon, 2 Jun 2014 15:34:25 +0000 (08:34 -0700)]
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.

10 years agoRemove some trailing spaces in source.c
Joel Brobecker [Mon, 2 Jun 2014 15:23:50 +0000 (08:23 -0700)]
Remove some trailing spaces in source.c

gdb/ChangeLog:

        * source.c (substitute_path_rule_matches): Remove trailing spaces.

10 years agoThis fixes a thinko in the LEON support recently added to the assembler.
Eric Botcazou [Mon, 2 Jun 2014 11:11:17 +0000 (13:11 +0200)]
This fixes a thinko in the LEON support recently added to the assembler.

opcodes/
* sparc-opc.c (cas): Disable for LEON.
(casl): Likewise.

10 years agofix typos in ChangeLog
Alan Modra [Mon, 2 Jun 2014 06:28:49 +0000 (15:58 +0930)]
fix typos in ChangeLog

10 years agofix 2014-05-28 ld Makefile.am changes
Alan Modra [Mon, 2 Jun 2014 04:24:54 +0000 (13:54 +0930)]
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.

10 years agodaily update
Alan Modra [Mon, 2 Jun 2014 00:00:41 +0000 (09:30 +0930)]
daily update

10 years agoFix PowerPC64 ELFv2 icf_safe failures
Alan Modra [Sun, 1 Jun 2014 12:31:44 +0000 (22:01 +0930)]
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.

10 years agoguile: Allow compilation with Guile <= 2.0.5.
Ludovic Courtès [Tue, 27 May 2014 12:02:21 +0000 (14:02 +0200)]
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.

10 years ago2014-06-01 Ray Donnelly <mingw.android@gmail.com>
Kai Tietz [Sun, 1 Jun 2014 20:11:56 +0000 (22:11 +0200)]
2014-06-01  Ray Donnelly  <mingw.android@gmail.com>

* pex-win32.c (argv_to_cmdline): Don't quote
args unnecessarily.

10 years agoSkip test 'watch -location nullptr->p->x' if null pointer can be dereferenced
Yao Qi [Wed, 28 May 2014 04:38:52 +0000 (12:38 +0800)]
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.

10 years agodaily update
Alan Modra [Sun, 1 Jun 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sat, 31 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoAdd a TRY_CATCH to get_prev_frame_always to better manage errors during unwind.
Andrew Burgess [Wed, 28 May 2014 22:34:43 +0000 (23:34 +0100)]
Add a TRY_CATCH to get_prev_frame_always to better manage errors during unwind.

  https://sourceware.org/ml/gdb-patches/2014-05/msg00737.html

Currently a MEMORY_ERROR raised during unwinding a frame will cause the
unwind to stop with an error message, for example:

  (gdb) bt
  #0  breakpt () at amd64-invalid-stack-middle.c:27
  #1  0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
  #2  0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
  #3  0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
  #4  0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
  Cannot access memory at address 0x2aaaaaab0000

However, frame #4 is marked as being the end of the stack unwind, so a
subsequent request for the backtrace looses the error message, such as:

  (gdb) bt
  #0  breakpt () at amd64-invalid-stack-middle.c:27
  #1  0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
  #2  0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
  #3  0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
  #4  0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50

When fetching the backtrace, or requesting the stack depth using the MI
interface the situation is even worse, the first time a request is made
we encounter the memory error and so the MI returns an error instead of
the correct result, for example:

  (gdb) -stack-info-depth
  ^error,msg="Cannot access memory at address 0x2aaaaaab0000"

Or,

  (gdb) -stack-list-frames
  ^error,msg="Cannot access memory at address 0x2aaaaaab0000"

However, once one of these commands has been used gdb has, internally,
walked the stack and figured that out that frame #4 is the bottom of the
stack, so the second time an MI command is tried you'll get the "expected"
result:

  (gdb) -stack-info-depth
  ^done,depth="5"

Or,

  (gdb) -stack-list-frames
  ^done,stack=[frame={level="0", .. snip lots .. }]

After this patch the MEMORY_ERROR encountered during the frame unwind is
attached to frame #4 as the stop reason, and is displayed in the CLI each
time the backtrace is requested.  In the MI, catching the error means that
the "expected" result is returned the first time the MI command is issued.
So, from the CLI the results of the backtrace will be:

  (gdb) bt
  #0  breakpt () at amd64-invalid-stack-middle.c:27
  #1  0x00000000004008f0 in func5 () at amd64-invalid-stack-middle.c:32
  #2  0x0000000000400900 in func4 () at amd64-invalid-stack-middle.c:38
  #3  0x0000000000400910 in func3 () at amd64-invalid-stack-middle.c:44
  #4  0x0000000000400928 in func2 () at amd64-invalid-stack-middle.c:50
  Backtrace stopped: Cannot access memory at address 0x2aaaaaab0000

Each and every time that the backtrace is requested, while the MI output
will similarly be consistently:

  (gdb) -stack-info-depth
  ^done,depth="5"

Or,

  (gdb) -stack-list-frames
  ^done,stack=[frame={level="0", .. snip lots .. }]

gdb/ChangeLog:

* frame.c (struct frame_info): Add stop_string field.
(get_prev_frame_always_1): Renamed from get_prev_frame_always.
(get_prev_frame_always): Old content moved into
get_prev_frame_always_1.  Call get_prev_frame_always_1 inside
TRY_CATCH, handle MEMORY_ERROR exceptions.
(frame_stop_reason_string): New function definition.
* frame.h (unwind_stop_reason_to_string): Extend comment to
mention frame_stop_reason_string.
(frame_stop_reason_string): New function declaration.
* stack.c (frame_info): Switch to frame_stop_reason_string.
(backtrace_command_1): Switch to frame_stop_reason_string.
* unwind_stop_reason.def: Add UNWIND_MEMORY_ERROR.
(LAST_ENTRY): Changed to UNWIND_MEMORY_ERROR.
* guile/lib/gdb.scm: Add FRAME_UNWIND_MEMORY_ERROR to export list.

gdb/doc/ChangeLog:

* guile.texi (Frames In Guile): Mention FRAME_UNWIND_MEMORY_ERROR.
* python.texi (Frames In Python): Mention
gdb.FRAME_UNWIND_MEMORY_ERROR.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-invalid-stack-middle.exp: Update expected results.
* gdb.arch/amd64-invalid-stack-top.exp: Likewise.

10 years agoRename frame_stop_reason_string to unwind_stop_reason_to_string.
Andrew Burgess [Wed, 28 May 2014 21:46:33 +0000 (22:46 +0100)]
Rename frame_stop_reason_string to unwind_stop_reason_to_string.

  https://sourceware.org/ml/gdb-patches/2014-05/msg00721.html

This function is confusingly named, the "frame_" in the name implies it
somehow is frame dependent, when in reality the function just converts an
'enum unwind_stop_reason' value to a string.

gdb/ChangeLog:

* frame.c (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* frame.h (frame_stop_reason_string): Rename to ...
(unwind_stop_reason_to_string): this.
* stack.c (frame_info): Update call to frame_stop_reason_string.
(backtrace_command_1): Likewise.
* guile/scm-frame.c (gdbscm_unwind_stop_reason_string): Likewise.
* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.

10 years agoRemove previous frame if an error occurs when computing frame id during unwind.
Andrew Burgess [Wed, 2 Apr 2014 16:02:51 +0000 (17:02 +0100)]
Remove previous frame if an error occurs when computing frame id during unwind.

  https://sourceware.org/ml/gdb-patches/2014-05/msg00712.html

If an error is thrown during computing a frame id then the frame is left
in existence but without a valid frame id, this will trigger internal
errors if/when the frame is later visited (for example in a backtrace).

This patch catches errors raised while computing the frame id, and
arranges for the new frame, the one without a frame id, to be removed
from the linked list of frames.

gdb/ChangeLog:

* frame.c (remove_prev_frame): New function.
(get_prev_frame_if_no_cycle): Create / discard cleanup using
remove_prev_frame.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-invalid-stack-middle.S: New file.
* gdb.arch/amd64-invalid-stack-middle.c: New file.
* gdb.arch/amd64-invalid-stack-middle.exp: New file.
* gdb.arch/amd64-invalid-stack-top.c: New file.
* gdb.arch/amd64-invalid-stack-top.exp: New file.

10 years agoFix testsuite to use newly-built linker for ehdr_start_test_4, and fix
Cary Coutant [Fri, 30 May 2014 17:21:27 +0000 (10:21 -0700)]
Fix testsuite to use newly-built linker for ehdr_start_test_4, and fix
check script to look for the right binding.

gold/
* testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
* testsuite/Makefile.in: Regenerate.
* testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".

10 years agoPR breakpoints/17000: user breakpoint not inserted if software-single-step at same...
Pedro Alves [Fri, 30 May 2014 16:21:02 +0000 (17:21 +0100)]
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 a kfailed test.

gdb/testsuite/
2014-05-30  Pedro Alves  <palves@redhat.com>

PR breakpoints/17000
* gdb.base/sss-bp-on-user-bp.c: New file.
* gdb.base/sss-bp-on-user-bp.exp: New file.

10 years agoUse attribute to specify the required inlining semantics
David Blaikie [Fri, 30 May 2014 11:20:50 +0000 (12:20 +0100)]
Use attribute to specify the required inlining semantics

As suggested by Andrew Pinski.

gdb/testsuite/
* gdb.opt/inline-break.c: Fix clang compatibility by specifying
gnu_inline semantics via attribute.
* gdb.opt/inline-break.exp: Remove -std=c89 now that the test
source explicitly specifies the required semantics.

10 years agogdb.reverse/sigall-reverse.exp: Typo fix
Maciej W. Rozycki [Fri, 30 May 2014 03:14:17 +0000 (04:14 +0100)]
gdb.reverse/sigall-reverse.exp: Typo fix

* gdb.reverse/sigall-reverse.exp: Fix a typo.

10 years agodaily update
Alan Modra [Fri, 30 May 2014 00:00:44 +0000 (09:30 +0930)]
daily update

10 years agoRunning the current tree against my software-single-step-on-x86_64
Pedro Alves [Thu, 29 May 2014 21:17:20 +0000 (22:17 +0100)]
Running the current tree against my software-single-step-on-x86_64
branch showed some extra assertions I have in place triggering.  Turns
out my previous change to 'resume' was incomplete, and we mishandle
the 'hw_step' / 'step' variable pair.  (I swear I had fixed this, but
I guess I lost that in some local branch...)

Tested on x86_64 Fedora 20.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* infrun.c (resume): Rename local 'hw_step' to 'entry_step'
and make it const.  When a single-step decays to a continue,
clear 'step', not 'hw_step'.  Pass whether the caller wanted
to step to user_visible_resume_ptid, not what we ask the
target to do.

10 years agoinfrun.c: simplify "end stepping range" code a bit.
Pedro Alves [Thu, 27 Mar 2014 18:43:59 +0000 (18:43 +0000)]
infrun.c: simplify "end stepping range" code a bit.

 - all end_stepping_range callers also set stop_step.

 - all places that set stop_step call end_stepping_range and
   stop_waiting too.

IOW, all places where we handle "end stepping range" do:

      ecs->event_thread->control.stop_step = 1;
      end_stepping_range ();
      stop_waiting (ecs);

Factor that out into end_stepping_range itself.

Tested on x86_64 Fedora 20.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* infrun.c (process_event_stop_test, handle_step_into_function)
(handle_step_into_function_backward): Adjust.
Don't set the even thread's stop_step and call stop_waiting before
calling end_stepping_range.  Instead do that ...
(end_stepping_range): ... here.  Take an ecs pointer parameter.

10 years agoinfrun.c: stop_stepping -> stop_waiting.
Pedro Alves [Thu, 27 Mar 2014 18:42:53 +0000 (18:42 +0000)]
infrun.c: stop_stepping -> stop_waiting.

stop_stepping is called even when we weren't stepping.  It's job really is:

  static void
  stop_waiting (struct execution_control_state *ecs)
  {
  ...
    /* Let callers know we don't want to wait for the inferior anymore.  */
    ecs->wait_some_more = 0;
  }

So rename it for clarity.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* infrun.c (stop_stepping): Rename to ...
(stop_waiting): ... this.
(proceed): Update comment.
(process_event_stop_test, handle_inferior_event)
(handle_signal_stop, handle_step_into_function)
(handle_step_into_function_backward): Update.

10 years agounbreak infcalls
Pedro Alves [Thu, 29 May 2014 16:17:30 +0000 (17:17 +0100)]
unbreak infcalls

I managed to miss an interaction between the recent *running patch,
and target-async, which resulted in infcalls being completely broken
on GNU/Linux and remote targets (that is, the async-capable targets).

 Temporary breakpoint 1, main () at threads.c:35
 35          long i = 0;
 (gdb) p malloc (0)
 The program being debugged stopped while in a function called from GDB.
 Evaluation of the expression containing the function
 (malloc) will be abandoned.
 When the function is done executing, GDB will silently stop.
 (gdb) p malloc (0)

 Program received signal SIGSEGV, Segmentation fault.
 0x000000000058d7e8 in get_regcache_aspace (regcache=0x0) at ../../src/gdb/regcache.c:281
 281       return regcache->aspace;
 (top-gdb)

The issue is that when running an infcall, the thread is no longer
marked as running, so run_inferior_call is not calling
wait_for_inferior anymore.

Fix this by doing what the comment actually says we do:

  "Do here what `proceed' itself does in sync mode."

And proceed doesn't check whether the target is running.

I notice this is broken in case of the early return in proceed, but we
were broken before in that case anyway, because run_inferior_call will
think the call actually ran.  Seems like we should make proceed have a
boolean return, and go through all callers making use of it, if
necessary.

But for now, just fix the regression.

Tested on x86_64 Fedora 20.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* infcall.c (run_inferior_call): Don't check whether the current
thread is running after the proceed call.

10 years agoenable target async by default; separate MI and target notions of async
Pedro Alves [Thu, 29 May 2014 18:58:57 +0000 (19:58 +0100)]
enable target async by default; separate MI and target notions of async

This finally makes background execution commands possible by default.

However, in order to do that, there's one last thing we need to do --
we need to separate the MI and target notions of "async".  Unlike the
CLI, where the user explicitly requests foreground vs background
execution in the execution command itself (c vs c&), MI chose to treat
"set target-async" specially -- setting it changes the default
behavior of execution commands.

So, we can't simply "set target-async" default to on, as that would
affect MI frontends.  Instead we have to make the setting MI-specific,
and teach MI about sync commands on top of an async target.

Because the "target" word in "set target-async" ends up as a potential
source of confusion, the patch adds a "set mi-async" option, and makes
"set target-async" a deprecated alias.

Rather than make the targets always async, this patch introduces a new
"maint set target-async" option so that the GDB developer can control
whether the target is async.  This makes it simpler to debug issues
arising only in the synchronous mode; important because sync mode
seems unlikely to go away.

Unlike in previous revisions, "set target-async" does not affect this
new maint parameter.  The rationale for this is that then one can
easily run the test suite in the "maint set target-async off" mode and
have tests that enable mi-async fail just like they fail on
non-async-capable targets.  This emulation is exactly the point of the
maint option.

I had asked Tom in a previous iteration to split the actual change of
the target async default to a separate patch, but it turns out that
that is quite awkward in this version of the patch, because with MI
async and target async decoupled (unlike in previous versions), if we
don't flip the default at the same time, then just "set target-async
on" alone never actually manages to do anything.  It's best to not
have that transitory state in the tree.

Given "set target-async on" now only has effect for MI, the patch goes
through the testsuite removing it from non-MI tests.  MI tests are
adjusted to use the new and less confusing "mi-async" spelling.

2014-05-29  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

* NEWS: Mention "maint set target-async", "set mi-async", and that
background execution commands are now always available.
* target.h (target_async_permitted): Update comment.
* target.c (target_async_permitted, target_async_permitted_1):
Default to 1.
(set_target_async_command): Rename to ...
(maint_set_target_async_command): ... this.
(show_target_async_command): Rename to ...
(maint_show_target_async_command): ... this.
(_initialize_target): Adjust.
* infcmd.c (prepare_execution_command): Make extern.
* inferior.h (prepare_execution_command): Declare.
* infrun.c (set_observer_mode): Leave target async alone.
* mi/mi-interp.c (mi_interpreter_init): Install
mi_on_sync_execution_done as sync_execution_done observer.
(mi_on_sync_execution_done): New function.
(mi_execute_command_input_handler): Don't print the prompt if we
just started a synchronous command with an async target.
(mi_on_resume): Check sync_execution before printing prompt.
* mi/mi-main.h (mi_async_p): Declare.
* mi/mi-main.c: Include gdbcmd.h.
(mi_async_p): New function.
(mi_async, mi_async_1): New globals.
(set_mi_async_command, show_mi_async_command, mi_async): New
functions.
(exec_continue): Call prepare_execution_command.
(run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features)
(mi_execute_async_cli_command): Use mi_async_p.
(_initialize_mi_main): Install "set mi-async".  Make
"target-async" a deprecated alias.

2014-05-29  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

* gdb.texinfo (Non-Stop Mode): Remove "set target-async 1"
from example.
(Asynchronous and non-stop modes): Document '-gdb-set mi-async'.
Mention that target-async is now deprecated.
(Maintenance Commands): Document maint set/show target-async.

2014-05-29  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

* gdb.base/async-shell.exp: Don't enable target-async.
* gdb.base/async.exp
* gdb.base/corefile.exp (corefile_test_attach): Remove 'async'
parameter.  Adjust.
(top level): Don't test with "target-async".
* gdb.base/dprintf-non-stop.exp: Don't enable target-async.
* gdb.base/gdb-sigterm.exp: Don't test with "target-async".
* gdb.base/inferior-died.exp: Don't enable target-async.
* gdb.base/interrupt-noterm.exp: Likewise.
* gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async".
* gdb.mi/mi-nonstop-exit.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-ns-stale-regcache.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-watch-nonstop.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Adjust comment.
* gdb.python/py-evsignal.exp: Don't enable target-async.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-prompt.exp: Likewise.
* gdb.reverse/break-precsave.exp: Don't test with "target-async".
* gdb.server/solib-list.exp: Don't enable target-async.
* gdb.threads/thread-specific-bp.exp: Likewise.
* lib/mi-support.exp: Adjust to use mi-async.

10 years agoMake display_gdb_prompt CLI-only.
Pedro Alves [Fri, 23 May 2014 10:37:12 +0000 (11:37 +0100)]
Make display_gdb_prompt CLI-only.

Enabling target-async by default will require implementing sync
execution on top of an async target, much like foreground command are
implemented on the CLI in async mode.

In order to do that, we will need better control of when to print the
MI prompt.  Currently the interp->display_prompt_p hook is all we
have, and MI just always returns false, meaning, make
display_gdb_prompt a no-op.  We'll need to be able to know to print
the MI prompt in some of the conditions that display_gdb_prompt is
called from the core, but not all.

This is all a litte twisted currently.  As we can see,
display_gdb_prompt is really CLI specific, so make the console
interpreters (console/tui) themselves call it.  To be able to do that,
and add a few different observers that the interpreters can use to
distinguish when or why the the prompt is being printed:

#1 - one called whenever a command is cancelled due to an error.
#2 - another for when a foreground command just finished.

In both cases, CLI wants to print the prompt, while MI doesn't.

MI will want to print the prompt in the second case when in a special
MI mode.

The display_gdb_prompt call in interp_set made me pause.  The comment
there reads:

  /* Finally, put up the new prompt to show that we are indeed here.
     Also, display_gdb_prompt for the console does some readline magic
     which is needed for the console interpreter, at least...  */

But, that looks very much like a no-op to me currently:

 - the MI interpreter always return false in the prompt hook, meaning
   actually display no prompt.

 - the interpreter used at that point is still quiet.  And the
   console/tui interpreters return false in the prompt hook if they're
   quiet, meaning actually display no prompt.

The only remaining possible use would then be the readline magic.  But
whatever that might have been, it's not reacheable today either,
because display_gdb_prompt returns early, before touching readline if
the interpreter returns false in the display_prompt_p hook.

Tested on x86_64 Fedora 20, sync and async modes.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* cli/cli-interp.c (cli_interpreter_display_prompt_p): Delete.
(_initialize_cli_interp): Adjust.
* event-loop.c: Include "observer.h".
(start_event_loop): Notify 'command_error' observers instead of
calling display_gdb_prompt.  Remove FIXME comment.
* event-top.c (display_gdb_prompt): Remove call into the
interpreters.
* inf-loop.c: Include "observer.h".
(inferior_event_handler): Notify 'command_error' observers instead
of calling display_gdb_prompt.
* infrun.c (fetch_inferior_event): Notify 'sync_execution_done'
observers instead of calling display_gdb_prompt.
* interps.c (interp_set): Don't call display_gdb_prompt.
(current_interp_display_prompt_p): Delete.
* interps.h (interp_prompt_p): Delete declaration.
(interp_prompt_p_ftype): Delete.
(struct interp_procs) <prompt_proc_p>: Delete field.
(current_interp_display_prompt_p): Delete declaration.
* mi-interp.c (mi_interpreter_prompt_p): Delete.
(_initialize_mi_interp): Adjust.
* tui-interp.c (tui_init): Install 'sync_execution_done' and
'command_error' observers.
(tui_on_sync_execution_done, tui_on_command_error): New
functions.
(tui_display_prompt_p): Delete.
(_initialize_tui_interp): Adjust.

gdb/doc/
2014-05-29  Pedro Alves  <palves@redhat.com>

* observer.texi (sync_execution_done, command_error): New
subjects.

10 years agoPR gdb/13860 - Make MI sync vs async output (closer to) the same.
Pedro Alves [Thu, 29 May 2014 12:09:45 +0000 (13:09 +0100)]
PR gdb/13860 - Make MI sync vs async output (closer to) the same.

Ignoring expected and desired differences like whether the prompt is
output after *stoppped records, GDB MI output is still different in
sync and async modes.

In sync mode, when a CLI execution command is entered, the "reason"
field is missing in the *stopped async record.  And in async mode, for
some events, like program exits, the corresponding CLI output is
missing in the CLI channel.

Vis, diff between sync vs async modes:

   run
   ^running
   *running,thread-id="1"
   (gdb)
   ...
 - ~"[Inferior 1 (process 15882) exited normally]\n"
   =thread-exited,id="1",group-id="i1"
   =thread-group-exited,id="i1",exit-code="0"
 - *stopped
 + *stopped,reason="exited-normally"

   si
   ...
   (gdb)
   ~"0x000000000045e033\t29\t  memset (&args, 0, sizeof args);\n"
 - *stopped,frame=...,thread-id="1",stopped-threads="all",core="0"
 + *stopped,reason="end-stepping-range",frame=...,thread-id="1",stopped-threads="all",core="0"
   (gdb)

In addition, in both cases, when a MI execution command is entered,
and a breakpoint triggers, the event is sent to the console too.  But
some events like program exits have the CLI output missing in the CLI
channel:

   -exec-run
   ^running
   *running,thread-id="1"
   (gdb)
   ...
   =thread-exited,id="1",group-id="i1"
   =thread-group-exited,id="i1",exit-code="0"
 - *stopped
 + *stopped,reason="exited-normally"

We'll want to make background commands always possible by default.
IOW, make target-async be the default.  But, in order to do that,
we'll need to emulate MI sync on top of an async target.  That means
we'll have yet another combination to care for in the testsuite.

Rather than making the testsuite cope with all these differences, I
thought it better to just fix GDB to always have the complete output,
no matter whether it's in sync or async mode.

This is all related to interpreter-exec, and the corresponding uiout
switching.  (Typing a CLI command directly in MI is shorthand for
running it through -interpreter-exec console.)

In sync mode, when a CLI command is active, normal_stop is called when
the current interpreter and uiout are CLI's.  So print_XXX_reason
prints the stop reason to CLI uiout (only), and we don't show it in
MI.

In async mode the stop event is processed when we're back in the MI
interpreter, so the stop reason is printed directly to the MI uiout.

Fix this by making run control event printing roughly independent of
whatever is the current interpreter or uiout.  That is, move these
prints to interpreter observers, that know whether to print or be
quiet, and if printing, which uiout to print to.  In the case of the
console/tui interpreters, only print if the top interpreter.  For MI,
always print.

Breakpoint hits / normal stops are already handled similarly -- MI has
a normal_stop observer that prints the event to both MI and the CLI,
though that could be cleaned up further in the direction of this
patch.

This also makes all of:

 (gdb) foo
and
 (gdb) interpreter-exec MI "-exec-foo"
and
 (gdb)
 -exec-foo
and
 (gdb)
 -interpreter-exec console "foo"

print as expected.

Tested on x86_64 Fedora 20, sync and async modes.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

PR gdb/13860
* cli/cli-interp.c: Include infrun.h and observer.h.
(cli_uiout, cli_interp): New globals.
(cli_on_signal_received, cli_on_end_stepping_range)
(cli_on_signal_exited, cli_on_exited, cli_on_no_history): New
functions.
(cli_interpreter_init): Install them as 'end_stepping_range',
'signal_received' 'signal_exited', 'exited' and 'no_history'
observers.
(_initialize_cli_interp): Remove cli_interp local.
* infrun.c (handle_inferior_event): Call the several stop reason
observers instead of printing the stop reason directly.
(end_stepping_range): New function.
(print_end_stepping_range_reason, print_signal_exited_reason)
(print_exited_reason, print_signal_received_reason)
(print_no_history_reason): Make static, and add an uiout
parameter.  Print to that instead of to CURRENT_UIOUT.
* infrun.h (print_end_stepping_range_reason)
(print_signal_exited_reason, print_exited_reason)
(print_signal_received_reason print_no_history_reason): New
declarations.
* mi/mi-common.h (struct mi_interp): Rename 'uiout' field to
'mi_uiout'.
<cli_uiout>: New field.
* mi/mi-interp.c (mi_interpreter_init): Adjust.  Create the new
uiout for CLI output.  Install 'signal_received',
'end_stepping_range', 'signal_exited', 'exited' and 'no_history'
observers.
(find_mi_interpreter, mi_interp_data, mi_on_signal_received)
(mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited)
(mi_on_no_history): New functions.
(ui_out_free_cleanup): Delete function.
(mi_on_normal_stop): Don't allocate a new uiout for CLI output,
instead use the one already stored in the MI interpreter data.
(mi_ui_out): Adjust.
* tui/tui-interp.c: Include infrun.h and observer.h.
(tui_interp): New global.
(tui_on_signal_received, tui_on_end_stepping_range)
(tui_on_signal_exited, tui_on_exited)
(tui_on_no_history): New functions.
(tui_init): Install them as 'end_stepping_range',
'signal_received' 'signal_exited', 'exited' and 'no_history'
observers.
(_initialize_tui_interp): Delete tui_interp local.

gdb/doc/
2014-05-29  Pedro Alves  <palves@redhat.com>

PR gdb/13860
* observer.texi (signal_received, end_stepping_range)
(signal_exited, exited, no_history): New observer subjects.

gdb/testsuite/
2014-05-29  Pedro Alves  <palves@redhat.com>

PR gdb/13860
* gdb.mi/mi-cli.exp: Always expect "end-stepping-range" stop
reason, even in sync mode.

10 years agoPR gdb/15713 - errors from i386_linux_resume lead to lock-up
Pedro Alves [Thu, 29 May 2014 11:50:48 +0000 (12:50 +0100)]
PR gdb/15713 - errors from i386_linux_resume lead to lock-up

linux_nat_resume is not considering that linux_ops->to_resume may throw:

  /* Mark LWP as not stopped to prevent it from being continued by
     linux_nat_resume_callback.  */
  lp->stopped = 0;

  if (resume_many)
    iterate_over_lwps (ptid, linux_nat_resume_callback, NULL);

If something within linux_nat_resume_callback throws, GDB leaves the
lwp_info as if the inferior was resumed, while it actually wasn't.

A couple examples, there are possibly others:

 - i386_linux_resume calls target_read which calls QUIT.
 - if the actual ptrace resumption fails in inf_ptrace_resume,
   perror_with_name is called.

If the user tries to kill the inferior at this point (or quit, which
offers to kill), GDB locks up trying to stop the lwp -- if it is
already stopped no new waitpid event gets generated for it.

Fix this by setting the stopped flag earlier, as soon as we collect a
stop event with waitpid, and clearing it always only after resuming
the lwp successfully.

Tested on x86_64 Fedora 20.  Confirmed the lock-up disappears using a
local hack that forces an error in inf_ptrace_resume.

Also fixes a little "set debug lin-lwp" annoyance.  Currently we always see:

 Continuing.
 LLR: Preparing to resume process 6802, 0, inferior_ptid Thread 0x7ffff7fc7740 (LWP 6802)
                                                                                ^^^^^^^^
 RC: Resuming sibling Thread 0x7ffff77c5700 (LWP 6807), 0, resume
 RC: Resuming sibling Thread 0x7ffff7fc6700 (LWP 6806), 0, resume
 RC: Not resuming sibling Thread 0x7ffff7fc7740 (LWP 6802) (not stopped)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^
 LLR: PTRACE_CONT process 6802, 0 (resume event thread)

This patch gets rid of the "Not resuming sibling" line.

2014-05-29  Pedro Alves  <palves@redhat.com>

PR gdb/15713
* linux-nat.c (linux_nat_resume_callback): Rename the second
parameter to 'except'.  Skip LP if it points to EXCEPT.
(linux_nat_resume): Don't mark the event lwp as not stopped
before resuming sibling lwps.  Instead ask
linux_nat_resume_callback to skip the event lwp.  Mark it as not
stopped after actually resuming it.
(linux_handle_syscall_trap): Mark the lwp as not stopped after
resuming it.
(wait_lwp): Mark the lwp as stopped here.
(stop_wait_callback): Mark the lwp as not stopped right after
resuming it.  Don't mark lwps as stopped here.
(linux_nat_filter_event): Mark the lwp as stopped earlier.
(linux_nat_wait_1): Don't mark dead lwps as stopped here.

10 years agoPR15693 - Fix spurious *running events, thread state, dprintf-style call
Pedro Alves [Thu, 29 May 2014 11:27:01 +0000 (12:27 +0100)]
PR15693 - Fix spurious *running events, thread state, dprintf-style call

If one sets a breakpoint with a condition that involves calling a
function in the inferior, and then the condition evaluates false, GDB
outputs one *running event for each time the program hits the
breakpoint.  E.g.,

  $ gdb return-false -i=mi

  (gdb)
  start
  ...
  (gdb)
  b 14 if return_false ()
  &"b 14 if return_false ()\n"
  ~"Breakpoint 2 at 0x4004eb: file return-false.c, line 14.\n"
  ...
  ^done
  (gdb)
  c
  &"c\n"
  ~"Continuing.\n"
  ^running
  *running,thread-id=(...)
  (gdb)
  *running,thread-id=(...)
  *running,thread-id=(...)
  *running,thread-id=(...)
  *running,thread-id=(...)
  *running,thread-id=(...)
  ... repeat forever ...

An easy way a user can trip on this is with a dprintf with "set
dprintf-style call".  In that case, a dprintf is just a breakpoint
that when hit GDB calls the printf function in the inferior, and then
resumes it, just like the case above.

If the breakpoint/dprintf is set in a loop, then these spurious events
can potentially slow down a frontend much, if it decides to refresh
its GUI whenever it sees this event (Eclipse is one such case).

When we run an infcall, we pretend we don't actually run the inferior.
This is already handled for the usual case of calling a function
directly from the CLI:

 (gdb)
 p return_false ()
 &"p return_false ()\n"
 ~"$1 = 0"
 ~"\n"
 ^done
 (gdb)

Note no *running, nor *stopped events.  That's handled by:

 static void
 mi_on_resume (ptid_t ptid)
 {
...
   /* Suppress output while calling an inferior function.  */
   if (tp->control.in_infcall)
     return;

and equivalent code on normal_stop.

However, in the cases of the PR, after finishing the infcall there's
one more resume, and mi_on_resume doesn't know that it should suppress
output then too, somehow.

The "running/stopped" state is a high level user/frontend state.
Internal stops are invisible to the frontend.  If follows from that
that we should be setting the thread to running at a higher level
where we still know the set of threads the user _intends_ to resume.

Currently we mark a thread as running from within target_resume, a low
level target operation.  As consequence, today, if we resume a
multi-threaded program while stopped at a breakpoint, we see this:

 -exec-continue
 ^running
 *running,thread-id="1"
 (gdb)
 *running,thread-id="all"

The first *running was GDB stepping over the breakpoint, and the
second is GDB finally resuming everything.

Between those two *running's, threads other than "1" still have their
state set to stopped.  That's bogus -- in async mode, this opens a
tiny window between both resumes where the user might try to run
another execution command to threads other than thread 1, and very
much confuse GDB.

That is, the "step" below should fail the "step", complaining that the
thread is running:

  (gdb) c -a &
  (gdb) thread 2
  (gdb) step

IOW, threads that GDB happens to not resume immediately (say, because
it needs to step over a breakpoint) shall still be marked as running.

Then, if we move marking threads as running to a higher layer,
decoupled from target_resume, plus skip marking threads as running
when running an infcall, the spurious *running events disappear,
because there will be no state transitions at all.

I think we might end up adding a new thread state -- THREAD_INFCALL or
some such, however since infcalls are always synchronous today, I
didn't find a need.  There's no way to execute a CLI/MI command
directly from the prompt if some thread is running an infcall.

Tested on x86_64 Fedora 20.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

PR PR15693
* infrun.c (resume): Determine how much to resume depending on
whether the caller wanted a step, not whether we can hardware step
the target.  Mark all threads that we intend to run as running,
unless we're calling an inferior function.
(normal_stop): If the thread is running an infcall, don't finish
thread state.
* target.c (target_resume): Don't mark threads as running here.

gdb/testsuite/
2014-05-29  Pedro Alves  <palves@redhat.com>
    Hui Zhu  <hui@codesourcery.com>

PR PR15693
* gdb.mi/mi-condbreak-call-thr-state-mt.c: New file.
* gdb.mi/mi-condbreak-call-thr-state-st.c: New file.
* gdb.mi/mi-condbreak-call-thr-state.c: New file.
* gdb.mi/mi-condbreak-call-thr-state.exp: New file.

10 years agodaily update
Alan Modra [Thu, 29 May 2014 00:01:08 +0000 (09:31 +0930)]
daily update

10 years agoFix demangler testsuite crashes with CP_DEMANGLE_DEBUG defined
Pedro Alves [Wed, 28 May 2014 22:06:44 +0000 (23:06 +0100)]
Fix demangler testsuite crashes with CP_DEMANGLE_DEBUG defined

Running the demangler's testsuite with CP_DEMANGLE_DEBUG defined
crashes, with:

 Program received signal SIGSEGV, Segmentation fault.
 0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
 567       switch (dc->type)

 (gdb) bt 3
 #0  0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
 #1  0x000000000040ae47 in d_dump (dc=0x7fffffffd098, indent=10) at ../../src/libiberty/cp-demangle.c:787
 #2  0x000000000040ae47 in d_dump (dc=0x7fffffffd0c8, indent=8) at ../../src/libiberty/cp-demangle.c:787

Note dc=0x1, which is obviously a bogus pointer.  This is the end of
d_dump recursing for a component type that that doesn't actually have
subtrees:

 787       d_dump (d_left (dc), indent + 2);
 788       d_dump (d_right (dc), indent + 2);

This fixes the two cases the testsuite currently trips on.

libiberty/
2014-05-28  Pedro Alves  <palves@redhat.com>

* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM
and DEMANGLE_COMPONENT_NUMBER.

10 years agoFix test in libiberty/testsuite/demangle-expected.
Thomas Schwinge [Wed, 28 May 2014 22:06:43 +0000 (23:06 +0100)]
Fix test in libiberty/testsuite/demangle-expected.

libiberty/
* testsuite/demangle-expected: Fix last commit.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210803 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agocplus-demangler, free resource after a failed call to gnu_special.
Andrew Burgess [Wed, 28 May 2014 22:06:43 +0000 (23:06 +0100)]
cplus-demangler, free resource after a failed call to gnu_special.

libiberty/
2014-05-14  Andrew Burgess  <aburgess@broadcom.com>

* cplus-dmem.c (internal_cplus_demangle): Free any resources
allocated by possible previous call to gnu_special.
(squangle_mop_up): Reset pointers to NULL after calling free.
* testsuite/demangle-expected: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210425 138bc75d-0d04-0410-961f-82ee72b054a4

10 years agoRemove "set/show remotebaud" (deprecated) commands.
Joel Brobecker [Mon, 19 May 2014 18:46:19 +0000 (11:46 -0700)]
Remove "set/show remotebaud" (deprecated) commands.

This patch removes support for the "set/show remotebaud" command,
which were deprecated in GDB 7.7, and should be now be removed
ahead of cutting the GDB 7.8 branch.

gdb/ChangeLog:

        * serial.c (_initialize_serial): Remove support for
        the "set remotebaud" and "show remotebaud" commands.
        * NEWS: Add entry documenting the removal of that command.

gdb/testsuite/ChangeLog:

        * config/monitor.exp (gdb_target_monitor): Replace use of
        "set remotebaud" by "set serial baud".

10 years agold: Split GENSCRIPTS rule from dependencies to fix tdir_'s.
Hans-Peter Nilsson [Wed, 28 May 2014 16:20:16 +0000 (18:20 +0200)]
ld: Split GENSCRIPTS rule from dependencies to fix tdir_'s.

* Makefile.am: Change all rules with ${GENSCRIPTS}
invocations to be just dependencies.
($(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES))
(run-genscripts): New rules.
* Makefile.in: Regenerate.

10 years agoAdd objcopy stage between assembly and linking for run_dump_test
mfortune [Tue, 27 May 2014 11:37:50 +0000 (12:37 +0100)]
Add objcopy stage between assembly and linking for run_dump_test

ld/testsuite/

* lib/ld-lib.exp: Add objcopy_objects command to run_dump_test.
This allows each input object to be optionally run through
objcopy before linking.

10 years agoFix rx "set but not used" warnings
Alan Modra [Wed, 28 May 2014 12:58:53 +0000 (22:28 +0930)]
Fix rx "set but not used" warnings

* elf32-rx.c (rx_table_map): Delete set but not used variables.

10 years agoaddr2line: fix missing inlined frames.
Tristan Gingold [Wed, 28 May 2014 07:21:11 +0000 (09:21 +0200)]
addr2line: fix missing inlined frames.

2014-05-28  Tristan Gingold  <gingold@adacore.com>

* dwarf2.c (lookup_address_in_function_table): Add best_fit_len
to keep the length of the best fit range.
(lookup_symbol_in_function_table, info_hash_lookup_funcinfo):
Likewise.

10 years agoFix typo in comments
Yao Qi [Tue, 27 May 2014 12:00:37 +0000 (20:00 +0800)]
Fix typo in comments

 "unsed" -> "used"

gdb:

2014-05-28  Yao Qi  <yao@codesourcery.com>

* charset.c: Fix typo in comments.

10 years agodaily update
Alan Modra [Wed, 28 May 2014 00:00:41 +0000 (09:30 +0930)]
daily update

10 years agoFix typo.
DJ Delorie [Tue, 27 May 2014 23:05:18 +0000 (19:05 -0400)]
Fix typo.

10 years agoAdd new link-map-text hook and RX auto-vector support.
DJ Delorie [Tue, 27 May 2014 21:14:49 +0000 (17:14 -0400)]
Add new link-map-text hook and RX auto-vector support.

* bfd/elf32-rx.c (get_symbol_value_maybe): New.
(rx_elf_relocate_section): If we find a reloc against
$tableentry$default$<name>, redirect it to the appropriate
$tableentry$<n>$.
(RX_Table_Info): New.
(rx_table_find): New.  Check all tables and SEC_KEEP all sections
with table parts in them.
(rx_check_directives): New.
(rx_table_map_2): New.
(rx_table_map): New.
(rx_additional_link_map_text): New.  Called to dump tables to the
map file.
* bfd/elf32-rx.h: New.

* ld/ldemul.h (extra_map_file_text): New field.
(ldemul_extra_map_file_text): Declare.
* ld/ldemul.c (ldemul_extra_map_file_text): Define.
* ld/ldlang.c (lang_map): Call it.

* ld/emultempl/rxelf.em: Add extra_map_file_text hook.
* ld/emultempl/aix.em: Add NULL extra_map_file_text hook.
* ld/emultempl/armcoff.em: Likewise.
* ld/emultempl/beos.em: Likewise.
* ld/emultempl/elf32.em: Likewise.
* ld/emultempl/generic.em: Likewise.
* ld/emultempl/gld960.em: Likewise.
* ld/emultempl/gld960c.em: Likewise.
* ld/emultempl/linux.em: Likewise.
* ld/emultempl/lnk960.em: Likewise.
* ld/emultempl/m68kcoff.em: Likewise.
* ld/emultempl/pe.em: Likewise.
* ld/emultempl/pep.em: Likewise.
* ld/emultempl/sunos.em: Likewise.
* ld/emultempl/ticoff.em: Likewise.
* ld/emultempl/vanilla.em: Likewise.

10 years agoProperly handle 64-bit GOT relocations
H.J. Lu [Tue, 27 May 2014 19:19:33 +0000 (12:19 -0700)]
Properly handle 64-bit GOT relocations

This patch fixes 2 issues:

1. Since the GOT offset is always negative, we need to use signed int
to support 64-bit GOT relocations.
2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is
the address of the .got.plt section, not the .got section.

10 years agoPrompt the user to file bug reports for internal errors and warnings.
Gary Benson [Tue, 27 May 2014 14:30:58 +0000 (15:30 +0100)]
Prompt the user to file bug reports for internal errors and warnings.

2014-05-27  Gary Benson  <gbenson@redhat.com>

* utils.c (internal_vproblem): Prompt for a bug report.

10 years agoremove unnecessary smob mark/free functions
Andy Wingo [Tue, 27 May 2014 01:11:58 +0000 (18:11 -0700)]
remove unnecessary smob mark/free functions

* guile/scm-arch.c (arscm_mark_arch_smob):
* guile/scm-block.c (bkscm_mark_block_smob)
(bkscm_mark_block_syms_progress_smob):
* guile/scm-breakpoint.c (bpscm_mark_breakpoint_smob):
* guile/scm-exception.c (exscm_mark_exception_smob):
* guile/scm-frame.c (frscm_mark_frame_smob):
* guile/scm-iterator.c (itscm_mark_iterator_smob):
* guile/scm-lazy-string.c (lsscm_mark_lazy_string_smob):
* guile/scm-objfile.c (ofscm_mark_objfile_smob):
* guile/scm-pretty-print.c (ppscm_mark_pretty_printer_smob)
(ppscm_mark_pretty_printer_worker_smob):
* guile/scm-symbol.c (syscm_mark_symbol_smob):
* guile/scm-symtab.c (stscm_mark_symtab_smob, stscm_mark_sal_smob):
* guile/scm-type.c (tyscm_mark_type_smob, tyscm_mark_field_smob):
* guile/scm-value.c (vlscm_mark_value_smob): Remove unnecessary
mark functions.
* guile/scm-symtab.c (stscm_free_sal_smob): Remove unnecessary free
function.

10 years agogdb smob cleanups
Andy Wingo [Tue, 27 May 2014 00:34:27 +0000 (17:34 -0700)]
gdb smob cleanups

* guile/guile-internal.h (GDB_SMOB_HEAD): Replace properties with
empty_base_class.  All uses updated.
(gdbscm_mark_gsmob, gdbscm_mark_chained_gsmob)
(gdbscm_mark_eqable_gsmob): Remove these now-unneeded functions.
Adapt all callers.
* guile/scm-gsmob.c (gdbscm_mark_gsmob)
(gdbscm_mark_chained_gsmob, gdbscm_mark_eqable_gsmob): Remove.
(gdbscm_gsmob_property, gdbscm_set_gsmob_property_x)
(gdbscm_gsmob_has_property_p, add_property_name)
(gdbscm_gsmob_properties): Remove, and remove them from gsmob_functions.
* guile/lib/gdb.scm (gdb-object-property, set-gdb-object-property)
(gdb-object-has-property?, gdb-object-properties): Remove.
(gdb-object-kind): Renamed from gsmob-kind.

doc/
* guile.texi (GDB Scheme Data Types): Remove documentation for
removed interfaces.  Update spelling of gdb-object-kind.

testsuite/
* gdb.guile/scm-breakpoint.exp:
* gdb.guile/scm-gsmob.exp: Update to use plain old object
properties instead of gdb-object-properties.

10 years agodaily update
Alan Modra [Tue, 27 May 2014 00:01:07 +0000 (09:31 +0930)]
daily update

10 years agoguile.texi (Basic Guile): Fix some typos.
Andy Wingo [Mon, 26 May 2014 22:34:24 +0000 (15:34 -0700)]
guile.texi (Basic Guile): Fix some typos.

10 years agoFix excess parentheses in use-modules forms.
Andy Wingo [Mon, 26 May 2014 22:06:29 +0000 (15:06 -0700)]
Fix excess parentheses in use-modules forms.

10 years agoAdd configure support for building with guile 2.2.
Andy Wingo [Mon, 26 May 2014 19:45:13 +0000 (12:45 -0700)]
Add configure support for building with guile 2.2.

* configure.ac (try_guile_versions): Allow building with guile 2.2.
* configure: Regenerate.

10 years agofix 80 cols overrun in earlier entry
Doug Evans [Mon, 26 May 2014 19:32:09 +0000 (12:32 -0700)]
fix 80 cols overrun in earlier entry

10 years agoSpecify source file explicitly when setting a breakpoint
Yao Qi [Tue, 20 May 2014 05:45:54 +0000 (13:45 +0800)]
Specify source file explicitly when setting a breakpoint

When I run no-thread-db.exp, the breakpoint is set on line 26.
However, the breakpoint is set to line 26 of dl-start.S rather than
no-thread-db.c, which is not intended.

(gdb) monitor set libthread-db-search-path /foo/bar^M
libthread-db-search-path set to `/foo/bar'^M
(gdb) PASS: gdb.server/no-thread-db.exp: libthread-db is now unresolvable
break 26^M
Breakpoint 1 at 0x48018078: file ../sysdeps/powerpc/powerpc32/dl-start.S, line 26.^M
(gdb) continue^M
Continuing.

This patch is to change the breakpoint setting with source file
specified, then it is correct now.

gdb/testsuite:

2014-05-26  Yao Qi  <yao@codesourcery.com>

* gdb.server/no-thread-db.exp: Specify source file name
explicitly when setting a breakpoint.

10 years agodaily update
Alan Modra [Mon, 26 May 2014 00:00:46 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sun, 25 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update