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.
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.
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.
Alan Modra [Sun, 1 Jun 2014 00:00:39 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 31 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update
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.
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.
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.
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".
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.
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.
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.
Alan Modra [Fri, 30 May 2014 00:00:44 +0000 (09:30 +0930)]
daily update
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.
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.
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.
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.
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.
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.
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.
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.
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.
Alan Modra [Thu, 29 May 2014 00:01:08 +0000 (09:31 +0930)]
daily update
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.
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
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
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".
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.
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.
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.
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.
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.
Alan Modra [Wed, 28 May 2014 00:00:41 +0000 (09:30 +0930)]
daily update
DJ Delorie [Tue, 27 May 2014 23:05:18 +0000 (19:05 -0400)]
Fix typo.
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.
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.
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.
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.
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.
Alan Modra [Tue, 27 May 2014 00:01:07 +0000 (09:31 +0930)]
daily update
Andy Wingo [Mon, 26 May 2014 22:34:24 +0000 (15:34 -0700)]
guile.texi (Basic Guile): Fix some typos.
Andy Wingo [Mon, 26 May 2014 22:06:29 +0000 (15:06 -0700)]
Fix excess parentheses in use-modules forms.
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.
Doug Evans [Mon, 26 May 2014 19:32:09 +0000 (12:32 -0700)]
fix 80 cols overrun in earlier entry
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.
Alan Modra [Mon, 26 May 2014 00:00:46 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 25 May 2014 00:00:42 +0000 (09:30 +0930)]
daily update
Alan Modra [Sat, 24 May 2014 13:10:11 +0000 (22:40 +0930)]
Localize varible to avoid warning
* ldlang.c (base): Move variable to..
* mri.c: ..here, and make static.
* ldlang.h (base): Delete declaration.
Eli Zaretskii [Sat, 24 May 2014 10:02:42 +0000 (13:02 +0300)]
Don't use @var at the beginning of a sentence in GDB documentation.
gdb/doc/guile.texi (Types In Guile, Basic Guile, Frames In Guile)
(Breakpoints In Guile, Guile Printing Module)
(Guile Exception Handling, Values From Inferior In Guile)
(Objfiles In Guile, Breakpoints In Guile, Memory Ports in Guile):
Don't use @var at the beginning of a sentence.
gdb/doc/gdb.texinfo (Frame Filter Management, Trace Files)
(C Operators, Ada Tasks, Calling, Bootstrapping, ARM)
(PowerPC Embedded, Define, Annotations for Running)
(IPA Protocol Commands, Packets, General Query Packets)
(Tracepoint Packets, Notification Packets, Environment)
(Inferiors and Programs, Set Breaks, Set Catchpoints)
(Continuing and Stepping, Signals, Thread-Specific Breakpoints)
(Frames, Backtrace, Selection, Expressions, Registers)
(Trace State Variables, Built-In Func/Proc, Signaling, Files)
(Numbers, GDB/MI Async Records, GDB/MI Data Manipulation)
(Source Annotations, Using JIT Debug Info Readers, Packets)
(Stop Reply Packets, Host I/O Packets)
(Target Description Format): Don't use @var at the beginning of a
sentence.
gdb/doc/python.texi (Basic Python, Types In Python)
(Commands In Python, Frames In Python, Line Tables In Python)
(Breakpoints In Python, gdb.printing, gdb.types)
(Type Printing API): Don't use @var at the beginning of a
sentence.
Alan Modra [Sat, 24 May 2014 00:00:45 +0000 (09:30 +0930)]
daily update
Ramana Radhakrishnan [Fri, 23 May 2014 08:01:14 +0000 (09:01 +0100)]
Include asm/ptrace.h for linux-aarch64-low.c
A recent change to glibc removed asm/ptrace.h from user.h for AArch64.
This meant that cross-native builds of gdbserver using trunk glibc broke
because linux-aarch64-low.c because user_hwdebug_state couldn't be found.
This is like commit #
036cd38182bde32d8297b630cd5c861d53b8949e
2014-05-23 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* linux-aarch64-low.c (asm/ptrace.h): Include.
Markus Metzger [Wed, 2 Apr 2014 07:54:11 +0000 (09:54 +0200)]
btrace, vdso: add vdso target sections
When loading symbols for the vdso, also add its sections to target_sections.
This fixes an issue with record btrace where vdso instructions could not be
disassembled during replay.
* symfile-mem.c (symbol_file_add_from_memory): Add BFD sections.
testsuite/
* gdb.btrace/vdso.c: New.
* gdb.btrace/vdso.exp: New.
Markus Metzger [Tue, 20 May 2014 07:48:43 +0000 (09:48 +0200)]
test, gcore: move capture_command_output into lib/gdb.exp
Allow gcore's capture_command_output function to be used by other tests.
testsuite/
* gdb.base/gcore.exp (capture_command_output): Move ...
* lib/gdb.exp (capture_command_output): ... here.
Markus Metzger [Wed, 5 Mar 2014 14:38:11 +0000 (15:38 +0100)]
btrace: control memory access during replay
The btrace record target does not trace data. We therefore do not allow
accessing read-write memory during replay.
In some cases, this might be useful to advanced users, though, who we assume
to know what they are doing.
Add a set|show command pair to turn this memory access restriction off.
* record-btrace.c (record_btrace_allow_memory_access): Remove.
(replay_memory_access_read_only, replay_memory_access_read_write)
(replay_memory_access_types, replay_memory_access)
(set_record_btrace_cmdlist, show_record_btrace_cmdlist)
(cmd_set_record_btrace, cmd_show_record_btrace)
(cmd_show_replay_memory_access): New.
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint): Replace
record_btrace_allow_memory_access with replay_memory_access.
(_initialize_record_btrace): Add commands.
* NEWS: Announce it.
testsuite/
* gdb.btrace/data.exp: Test it.
doc/
* gdb.texinfo (Process Record and Replay): Document it.
Alan Modra [Fri, 23 May 2014 00:01:04 +0000 (09:31 +0930)]
daily update
Simon Marchi [Thu, 22 May 2014 18:01:46 +0000 (14:01 -0400)]
Add comment for mi_run_cmd_full
It should clear up confusion about the args parameter to mi_run_cmd_full.
Thanks to Joel for clear formulation. I also added a comment about the
impact of use_gdb_stub.
gdb/testsuite/ChangeLog:
2014-05-22 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Add comments.
Ramana Radhakrishnan [Thu, 22 May 2014 15:07:20 +0000 (16:07 +0100)]
Include asm/ptrace.h in aarch64-linux-nat.c
A recent change to glibc removed asm/ptrace.h from user.h for
AArch64. This meant that cross-native builds of gdb using trunk
glibc broke because aarch64-linux-nat.c because user_hwdebug_state
couldn't be found.
Fixed by including asm/ptrace.h like other ports.
2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* aarch64-linux-nat.c (asm/ptrace.h): Include.
Ramana Radhakrishnan [Thu, 22 May 2014 15:06:33 +0000 (16:06 +0100)]
Reinstate self to Write After Approval
2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* MAINTAINERS (Write After Approval): Move self back from
paper trail.
Pedro Alves [Thu, 22 May 2014 11:29:11 +0000 (12:29 +0100)]
Add new infrun.h header.
Move infrun.c declarations out of inferior.h to a new infrun.h file.
Tested by building on:
i686-w64-mingw32, enable-targets=all
x86_64-linux, enable-targets=all
i586-pc-msdosdjgpp
And also grepped the whole tree for each symbol moved to find where
infrun.h might be necessary.
gdb/
2014-05-22 Pedro Alves <palves@redhat.com>
* inferior.h (debug_infrun, debug_displaced, stop_on_solib_events)
(sync_execution, sched_multi, step_stop_if_no_debug, non_stop)
(disable_randomization, enum exec_direction_kind)
(execution_direction, stop_registers, start_remote)
(clear_proceed_status, proceed, resume, user_visible_resume_ptid)
(wait_for_inferior, normal_stop, get_last_target_status)
(prepare_for_detach, fetch_inferior_event, init_wait_for_inferior)
(insert_step_resume_breakpoint_at_sal)
(follow_inferior_reset_breakpoints, stepping_past_instruction_at)
(set_step_info, print_stop_event, signal_stop_state)
(signal_print_state, signal_pass_state, signal_stop_update)
(signal_print_update, signal_pass_update)
(update_signals_program_target, clear_exit_convenience_vars)
(displaced_step_dump_bytes, update_observer_mode)
(signal_catch_update, gdb_signal_from_command): Move
declarations ...
* infrun.h: ... to this new file.
* amd64-tdep.c: Include infrun.h.
* annotate.c: Include infrun.h.
* arch-utils.c: Include infrun.h.
* arm-linux-tdep.c: Include infrun.h.
* arm-tdep.c: Include infrun.h.
* break-catch-sig.c: Include infrun.h.
* breakpoint.c: Include infrun.h.
* common/agent.c: Include infrun.h instead of inferior.h.
* corelow.c: Include infrun.h.
* event-top.c: Include infrun.h.
* go32-nat.c: Include infrun.h.
* i386-tdep.c: Include infrun.h.
* inf-loop.c: Include infrun.h.
* infcall.c: Include infrun.h.
* infcmd.c: Include infrun.h.
* infrun.c: Include infrun.h.
* linux-fork.c: Include infrun.h.
* linux-nat.c: Include infrun.h.
* linux-thread-db.c: Include infrun.h.
* monitor.c: Include infrun.h.
* nto-tdep.c: Include infrun.h.
* procfs.c: Include infrun.h.
* record-btrace.c: Include infrun.h.
* record-full.c: Include infrun.h.
* remote-m32r-sdi.c: Include infrun.h.
* remote-mips.c: Include infrun.h.
* remote-notif.c: Include infrun.h.
* remote-sim.c: Include infrun.h.
* remote.c: Include infrun.h.
* reverse.c: Include infrun.h.
* rs6000-tdep.c: Include infrun.h.
* s390-linux-tdep.c: Include infrun.h.
* solib-irix.c: Include infrun.h.
* solib-osf.c: Include infrun.h.
* solib-svr4.c: Include infrun.h.
* target.c: Include infrun.h.
* top.c: Include infrun.h.
* windows-nat.c: Include infrun.h.
* mi/mi-interp.c: Include infrun.h.
* mi/mi-main.c: Include infrun.h.
* python/py-threadevent.c: Include infrun.h.
Pedro Alves [Thu, 27 Mar 2014 13:13:59 +0000 (13:13 +0000)]
Don't store the inferior's exit code for --return-child-result in a print routine.
A small cleanup - so we can call the print routine without affecting
--return-child-result.
gdb/
2014-05-22 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event): Store the exit code for
--return-child-result here, instead of ...
(print_exited_reason): ... here.
Alan Modra [Thu, 22 May 2014 09:23:22 +0000 (18:53 +0930)]
Fix whitespace in gas listing errors and warnings
gas/
* listing.c (listing_warning, listing_error): Add space after colon.
* messages.c (as_warn_internal, as_bad_internal): Use the same
string as above.
gas/testsuite/
* gas/d30v/bittest.l: Update for changed whitespace.
* gas/d30v/serial.l: Likewise.
* gas/d30v/serial2.l: Likewise.
* gas/d30v/serial2O.l: Likewise.
* gas/d30v/warn_oddreg.l: Likewise.
* gas/i386/inval-equ-2.l: Likewise.
* gas/i386/mpx-inval-1.l: Likewise.
* gas/i386/sse-check-error.l: Likewise.
* gas/i386/x86-64-mpx-inval-1.l: Likewise.
* gas/i386/x86-64-mpx-inval-2.l: Likewise.
* gas/i386/x86-64-size-inval-1.l: Likewise.
* gas/i386/x86-64-sse-check-error.l: Likewise.
Alan Modra [Thu, 22 May 2014 00:01:09 +0000 (09:31 +0930)]
daily update
Pedro Alves [Tue, 11 Mar 2014 20:31:36 +0000 (20:31 +0000)]
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode.
The other part of PR gdb/13860 is about console execution commands in
MI getting their output half lost. E.g., take the finish command,
executed on a frontend's GDB console:
sync:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
~"0x00000000004004d7 in foo () at stepinf.c:6\n"
~"6\t usleep (10);\n"
~"Value returned is $1 = 0\n"
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1"
async:
finish
&"finish\n"
~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n"
^running
*running,thread-id="1"
(gdb)
*stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
Note how all the "Value returned" etc. output is missing in async mode.
The same happens with e.g., catchpoints:
=breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"}
~"\nCatchpoint "
~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n"
~"131\t pid = ARCH_FORK ();\n"
*stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/
glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0"
where all those ~ lines are missing in async mode, or just the "step"
current line indication:
s
&"s\n"
^running
*running,thread-id="all"
(gdb)
~"13\t foo ();\n"
*stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3"
(gdb)
Or in the case of the PRs example, the "Stopped due to shared library
event" note:
start
&"start\n"
~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"}
~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="21990"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event (no libraries added or removed)\n"
*stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3"
(gdb)
IMO, if you're typing execution commands in a frontend's console, you
expect to see their output. Indeed it's what you get in sync mode. I
think async mode should do the same. Deciding what to mirror to the
console wrt to breakpoints and random stops gets messy real fast.
E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the
event to the console in this case. But what about more complicated
cases like "s&; thread n; s&", and one of those steps spawning a new
thread, and that thread hitting a breakpoint? It's impossible in
general to track whether the thread had any relation to the commands
that had been executed. So I think we should just simplify and always
mirror breakpoints and random events to the console.
Notes:
- mi->out is the same as gdb_stdout when MI is the current
interpreter. I think that referring to that directly is cleaner.
An earlier revision of this patch made the changes that are now
done in mi_on_normal_stop directly in infrun.c:normal_stop, and so
not having an obvious place to put the new uiout by then, and not
wanting to abuse CLI's uiout, I made a temporary uiout when
necessary.
- Hopefuly the rest of the patch is more or less obvious given the
comments added.
Tested on x86_64 Fedora 20, no regressions.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdbthread.h (struct thread_control_state): New field
`command_interp'.
* infrun.c (follow_fork): Copy the new thread control field to the
child fork thread.
(clear_proceed_status_thread): Clear the new thread control field.
(proceed): Set the new thread control field.
* interps.h (command_interp): Declare.
* interps.c (command_interpreter): New global.
(command_interp): New function.
(interp_exec): Set `command_interpreter' while here.
* cli-out.c (cli_uiout_dtor): New function.
(cli_ui_out_impl): Install it.
* mi/mi-interp.c: Include cli-out.h.
(mi_cmd_interpreter_exec): Add comment.
(restore_current_uiout_cleanup): New function.
(ui_out_free_cleanup): New function.
(mi_on_normal_stop): If finishing an execution command started by
a CLI command, or any kind of breakpoint-like event triggered,
print the stop event to the output (CLI) stream.
* mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler.
2014-05-21 Pedro Alves <palves@redhat.com>
PR gdb/13860
* gdb.mi/mi-cli.exp (line_callee4_next_step): New global.
(top level): Test that output related to execution commands is
sent to the console with CLI commands, but not with MI commands.
Test that breakpoint events are always mirrored to the console.
Also expect the new source line to be output after a "next" in
async mode too. Make it a pass/fail test.
* gdb.mi/mi-solib.exp: Test that the CLI solib event note is
output.
* lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
Pedro Alves [Wed, 21 May 2014 22:15:27 +0000 (23:15 +0100)]
PR gdb/13860: make -interpreter-exec console "list" behave more like "list".
I noticed that "list" behaves differently in CLI vs MI. Particularly:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli
Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done.
(gdb) start
Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62.
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli
Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62
62 callee1 (2, "A string argument.", 3.5);
(gdb) list
57 {
58 }
59
60 main ()
61 {
62 callee1 (2, "A string argument.", 3.5);
63 callee1 (2, "A string argument.", 3.5);
64
65 do_nothing (); /* Hello, World! */
66
(gdb)
Note the list started at line 57. IOW, the program stopped at line
62, and GDB centered the list on that.
compare with:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..."
~"done.\n"
(gdb)
start
&"start\n"
...
~"\nTemporary breakpoint "
~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n"
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0"
=breakpoint-deleted,id="1"
(gdb)
-interpreter-exec console list
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
~"63\t callee1 (2, \"A string argument.\", 3.5);\n"
~"64\t\n"
~"65\t do_nothing (); /* Hello, World! */\n"
~"66\t\n"
~"67\t callme (1);\n"
~"68\t callme (2);\n"
~"69\t\n"
~"70\t return 0;\n"
~"71\t}\n"
^done
(gdb)
Here the list starts at line 62, where the program was stopped.
This happens because print_stack_frame, called from both normal_stop
and mi_on_normal_stop, is the function responsible for setting the
current sal from the selected frame, overrides the PRINT_WHAT
argument, and only after that does it decide whether to center the
current sal line or not, based on the overridden value, and it will
always decide false.
(The print_stack_frame call in mi_on_normal_stop is a little different
from the call in normal_stop, in that it is an unconditional
SRC_AND_LOC call. A future patch will make those uniform.)
A previous version of this patch made MI uniform with CLI here, by
making print_stack_frame also center when MI is active. That changed
the output of a "list" command in mi-cli.exp, to expect line 57
instead of 62, as per the example above.
However, looking deeper, that list in question is the first "list"
after the program stops, and right after the stop, before the "list",
the test did "set listsize 1". Let's try the same thing with the CLI:
(gdb) start
62 callee1 (2, "A string argument.", 3.5);
(gdb) set listsize 1
(gdb) list
57 {
Huh, that's unexpected. Why the 57? It's because print_stack_frame,
called in reaction to the breakpoint stop, expecting the next "list"
to show 10 lines (the listsize at the time) around line 62, sets the
lines listed range to 57-67 (62 +/- 5). If the user changes the
listsize before "list", why would we still show that range? Looks
bogus to me.
So the fix for this whole issue should be delay trying to center the
listing to until actually listing, so that the correct listsize can be
taken into account. This makes MI and CLI uniform too, as it deletes
the center code from print_stack_frame.
A series of tests are added to list.exp to cover this. mi-cli.exp was
after all correct all along, but it now gains an additional test that
lists lines with listsize 10, to ensure the centering is consistent
with CLI's.
One related Python test changed related output -- it's a test that
prints the line number after stopping for a breakpoint, similar to the
new list.exp tests. Previously we'd print the stop line minus 5 (due
to the premature centering), now we print the stop line. I think
that's a good change.
Tested on x86_64 Fedora 20.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (list_command): Handle the first "list" after the
current source line having changed.
* frame.h (set_current_sal_from_frame): Remove 'center' parameter.
* infrun.c (normal_stop): Adjust call to
set_current_sal_from_frame.
* source.c (clear_lines_listed_range): New function.
(set_current_source_symtab_and_line, identify_source_line): Clear
the lines listed range.
(line_info): Handle the first "info line" after the current source
line having changed.
* stack.c (print_stack_frame): Remove center handling.
(set_current_sal_from_frame): Remove 'center' parameter. Don't
center sal.line.
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/list.exp (build_pattern, test_list): New procedures.
Use them to test variations of "list" after reaching a breakpoint.
* gdb.mi/mi-cli.exp (line_main_callme_2): New global.
Test "list" with listsize 10 after reaching a breakpoint.
* gdb.python/python.exp (decode_line current location line
number): Adjust expected line number.
Doug Evans [Wed, 21 May 2014 22:00:31 +0000 (15:00 -0700)]
fix file names in earlier checkin
Simon Marchi [Wed, 21 May 2014 21:22:48 +0000 (17:22 -0400)]
Revert "Fix argument passing in mi_run_cmd_full"
This reverts commit
8c217a4b684386aa5ce6a078dffbe63265a524e6.
Following this
https://sourceware.org/ml/gdb-patches/2014-05/msg00462.html
I suggest reverting my previous commit. I will follow with another
patch to add comments, to clarify some things as stated in the mail
thread.
I ran make check with on gdb.mi, and the test that the commit broke
passes again.
gdb/testsuite/ChangeLog:
2014-05-21 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_run_cmd_full): Revert to original
behavior for $args, pass it directly to "run".
Pedro Alves [Wed, 21 May 2014 21:28:23 +0000 (22:28 +0100)]
Native targets: Add inf-child.c:inf_child_mourn_inferior and use it.
Most ports do the same thing in the tail of their mourn routine - call
generic_mourn_inferior+inf_child_maybe_unpush_target.
This factors that out to a convenience function. More could be done,
but this converts only the really obvious ones.
Tested by building GDB on x86_64 Fedora 20, mingw32 and djgpp. The
rest is untested, but I think a patch can't get more obvious.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* inf-child.c (inf_child_mourn_inferior): New function.
* inf-child.h (inf_child_mourn_inferior): New declaration.
* darwin-nat.c (darwin_mourn_inferior): Use
inf_child_mourn_inferior.
* gnu-nat.c (gnu_mourn_inferior): Likewise.
* inf-ptrace.c (inf_ptrace_mourn_inferior): Likewise.
* inf-ttrace.c (inf_ttrace_mourn_inferior): Likewise.
* nto-procfs.c (procfs_mourn_inferior): Likewise.
* windows-nat.c (windows_mourn_inferior): Likewise.
Maciej W. Rozycki [Wed, 21 May 2014 19:34:57 +0000 (20:34 +0100)]
gdb/testsuite: Bump up `match_max'
This fixes:
PASS: gdb.base/info-macros.exp: info macro -a -- FOO
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: info macros 2
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: info macros 3
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: info macros 4
FAIL: gdb.base/info-macros.exp: info macros *$pc
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: next
FAIL: gdb.base/info-macros.exp: info macros
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: next
FAIL: gdb.base/info-macros.exp: info macros 6
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: next
FAIL: gdb.base/info-macros.exp: info macros 7
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/info-macros.exp: info macros info-macros.c:42 (PRMS
gdb/NNNN)
with the arm-eabi target tested on the i686-mingw32 host where GCC
defines enough macros to exhaust expect's 30000 characters of buffer
space.
* lib/gdb.exp (default_gdb_init): Bump `match_max' up from
30000 to 65536.
Doug Evans [Wed, 21 May 2014 19:04:45 +0000 (12:04 -0700)]
* scm-breakpoint.c (breakpoint_functions): Fix typo.
Doug Evans [Wed, 21 May 2014 18:52:51 +0000 (11:52 -0700)]
Make exception throwers have void result. Delete unused gdbscm_scm_to_target_string_unsafe.
* scm-exception.c (gdbscm_invalid_object_error): Make result is void.
(gdbscm_out_of_range_error): Ditto.
(gdbscm_memory_error): Ditto.
* scm-string.c (gdbscm_scm_to_target_string_unsafe): Delete.
* guile-internal.h (gdbscm_invalid_object_error): Update.
(gdbscm_out_of_range_error): Update.
(gdbscm_memory_error): Update.
(gdbscm_scm_to_target_string_unsafe): Delete.
Pedro Alves [Wed, 21 May 2014 17:30:47 +0000 (18:30 +0100)]
Allow making GDB not automatically connect to the native target.
Sometimes it's useful to be able to disable the automatic connection
to the native target. E.g., sometimes GDB disconnects from the
extended-remote target I was debugging, without me noticing it, and
then I do "run". That starts the program locally, and only after a
little head scratch session do I figure out the program is running
locally instead of remotely as intended. Same thing with "attach",
"info os", etc.
With the patch, we now can have this instead:
(gdb) set auto-connect-native-target off
(gdb) target extended-remote :9999
...
*gdb disconnects*
(gdb) run
Don't know how to run. Try "help target".
To still be able to connect to the native target with
auto-connect-native-target set to off, I've made "target native" work
instead of erroring out as today.
Before:
(gdb) target native
Use the "run" command to start a native process.
After:
(gdb) target native
Done. Use the "run" command to start a process.
(gdb) maint print target-stack
The current target stack is:
- native (Native process)
- exec (Local exec file)
- None (None)
(gdb) run
Starting program: ./a.out
...
I've also wanted this for the testsuite, when running against the
native-extended-gdbserver.exp board (runs against gdbserver in
extended-remote mode). With a non-native-target board, it's always a
bug to launch a program with the native target. Turns out we still
have one such case this patch catches:
(gdb) break main
Breakpoint 1 at 0x4009e5: file ../../../src/gdb/testsuite/gdb.base/coremaker.c, line 138.
(gdb) run
Don't know how to run. Try "help target".
(gdb) FAIL: gdb.base/corefile.exp: run: with core
On the patch itself, probably the least obvious bit is the need to go
through all targets, and move the unpush_target call to after the
generic_mourn_inferior call instead of before. This is what
inf-ptrace.c does too, ever since multi-process support was added.
The reason inf-ptrace.c does things in that order is that in the
current multi-process/single-target model, we shouldn't unpush the
target if there are still other live inferiors being debugged. The
check for that is "have_inferiors ()" (a misnomer nowadays...), which
does:
have_inferiors (void)
{
for (inf = inferior_list; inf; inf = inf->next)
if (inf->pid != 0)
return 1;
It's generic_mourn_inferior that ends up clearing inf->pid, so we need
to call it before the have_inferiors check. To make all native
targets behave the same WRT to explicit "target native", I've added an
inf_child_maybe_unpush_target function that targets call instead of
calling unpush_target directly, and as that includes the
have_inferiors check, I needed to adjust the targets.
Tested on x86_64 Fedora 20, native, and also with the
extended-gdbserver board.
Confirmed a cross build of djgpp gdb still builds.
Smoke tested a cross build of Windows gdb under Wine.
Untested otherwise.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* inf-child.c (inf_child_ops, inf_child_explicitly_opened): New
globals.
(inf_child_open_target): New function.
(inf_child_open): Use inf_child_open_target to push the target
instead of erroring out.
(inf_child_disconnect, inf_child_close)
(inf_child_maybe_unpush_target): New functions.
(inf_child_target): Install inf_child_disconnect and
inf_child_close. Store a pointer to the returned object.
* inf-child.h (inf_child_open_target, inf_child_maybe_unpush): New
declarations.
* target.c (auto_connect_native_target): New global.
(show_default_run_target): New function.
(find_default_run_target): Return NULL if automatically connecting
to the native target is disabled.
(_initialize_target): Install set/show auto-connect-native-target.
* NEWS: Mention "set auto-connect-native-target", and "target
native".
* linux-nat.c (super_close): New global.
(linux_nat_close): Call super_close.
(linux_nat_add_target): Store a pointer to the base class's
to_close method.
* inf-ptrace.c (inf_ptrace_mourn_inferior, inf_ptrace_detach): Use
inf_child_maybe_unpush.
* inf-ttrace.c (inf_ttrace_him): Don't push the target if it is
already pushed.
(inf_ttrace_mourn_inferior): Only unpush the target after mourning
the inferior. Use inf_child_maybe_unpush_target.
(inf_ttrace_attach): Don't push the target if it is already
pushed.
(inf_ttrace_detach): Use inf_child_maybe_unpush_target.
* darwin-nat.c (darwin_mourn_inferior): Only unpush the target
after mourning the inferior. Use inf_child_maybe_unpush_target.
(darwin_attach_pid): Don't push the target if it is already
pushed.
* gnu-nat.c (gnu_mourn_inferior): Only unpush the target after
mourning the inferior. Use inf_child_maybe_unpush_target.
(gnu_detach): Use inf_child_maybe_unpush_target.
* go32-nat.c (go32_create_inferior): Don't push the target if it
is already pushed.
(go32_mourn_inferior): Use inf_child_maybe_unpush_target.
* nto-procfs.c (procfs_is_nto_target): Adjust comment.
(procfs_open): Rename to ...
(procfs_open_1): ... this. Add target_ops parameter. Adjust
comments. Can target_preopen before changing node. Call
inf_child_open_target to push the target explicitly.
(procfs_attach): Don't push the target if it is already pushed.
(procfs_detach): Use inf_child_maybe_unpush_target.
(procfs_create_inferior): Don't push the target if it is already
pushed.
(nto_native_ops): New global.
(procfs_open): Reimplement.
(procfs_native_open): New function.
(init_procfs_targets): Install procfs_native_open as to_open of
"target native". Store a pointer to the "native" target in
nto_native_ops.
* procfs.c (procfs_attach): Don't push the target if it is already
pushed.
(procfs_detach): Use inf_child_maybe_unpush_target.
(procfs_mourn_inferior): Only unpush the target after mourning the
inferior. Use inf_child_maybe_unpush_target.
(procfs_init_inferior): Don't push the target if it is already
pushed.
* windows-nat.c (do_initial_windows_stuff): Don't push the target
if it is already pushed.
(windows_detach): Use inf_child_maybe_unpush_target.
(windows_mourn_inferior): Only unpush the target after mourning
the inferior. Use inf_child_maybe_unpush_target.
gdb/doc/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting): Document "set/show
auto-connect-native-target".
(Target Commands): Document "target native".
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* boards/gdbserver-base.exp (GDBFLAGS): Set to "set
auto-connect-native-target off".
* gdb.base/auto-connect-native-target.c: New file.
* gdb.base/auto-connect-native-target.exp: New file.
Pedro Alves [Wed, 21 May 2014 17:30:46 +0000 (18:30 +0100)]
NEWS: Mention native target renames.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* NEWS: Mention that the "child", "GNU, "djgpp", "darwin-child"
and "procfs" targets are now called "native" instead.
Pedro Alves [Wed, 21 May 2014 17:30:46 +0000 (18:30 +0100)]
go32-nat.c: Don't override to_open.
Although the string says "Done.", nothing is pushing the target as is.
Removing the method override let's us fall through to the the base
to_open implemention in inf-child.c, which will push the target in
reaction to "target native" in a follow up patch.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_open): Delete.
(go32_target): Don't override the to_open method.
Pedro Alves [Wed, 21 May 2014 17:30:45 +0000 (18:30 +0100)]
nto-procfs.c: Add "target native".
This makes QNX/NTO end up with two targets. It preserves "target
procfs <node>", and adds a "native" target to be like other native
ports.
Not tested.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* nto-procfs.c (procfs_can_run): New function.
(nto_procfs_ops): New global.
(init_procfs_targets): New, based on procfs_target. Install
"target native" in addition to "target procfs".
(_initialize_procfs): Call init_procfs_targets instead of adding
the target here.
Pedro Alves [Wed, 21 May 2014 17:30:45 +0000 (18:30 +0100)]
Windows: Rename "target child" -> "target native"
To be like other native targets.
Leave to_shortname, to_longname, to_doc as inf-child.c sets them:
t->to_shortname = "native";
t->to_longname = "Native process";
t->to_doc = "Native process (started by the \"run\" command).";
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* windows-nat.c (windows_target): Don't override to_shortname,
to_longname or to_doc.
Pedro Alves [Wed, 21 May 2014 17:30:44 +0000 (18:30 +0100)]
Rename "target GNU" -> "target native"
To be like other native targets.
Leave to_shortname, to_longname, to_doc as inf-child.c sets them:
t->to_shortname = "native";
t->to_longname = "Native process";
t->to_doc = "Native process (started by the \"run\" command).";
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* gnu-nat.c (gnu): Don't override to_shortname, to_longname or
to_doc.
Pedro Alves [Wed, 21 May 2014 17:30:43 +0000 (18:30 +0100)]
Rename "target darwin-child" -> "target native"
To be like other native targets.
Leave to_shortname, to_longname, to_doc as inf-child.c sets them:
t->to_shortname = "native";
t->to_longname = "Native process";
t->to_doc = "Native process (started by the \"run\" command).";
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* darwin-nat.c (_initialize_darwin_inferior): Don't override
to_shortname, to_longname or to_doc.
Pedro Alves [Wed, 21 May 2014 17:30:43 +0000 (18:30 +0100)]
Rename "target djgpp" -> "target native"
To be like other native targets.
Leave to_shortname, to_longname, to_doc as inf-child.c sets them:
t->to_shortname = "native";
t->to_longname = "Native process";
t->to_doc = "Native process (started by the \"run\" command).";
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_target): Don't override to_shortname,
to_longname or to_doc.
Pedro Alves [Wed, 21 May 2014 17:30:43 +0000 (18:30 +0100)]
Rename "target child" to "target native".
I had been pondering renaming "target child" to something else.
"child" is a little lie in case of "attach", and not exactly very
clear to users, IMO. By best suggestion is "target native". If I
were to explain what "target child" is, I'd just start out with "it's
the native target" anyway. I was worrying a little that "native"
might be a lie too if some port comes up with a default target that
can run but is not really native, but I think that's a very minor
issue - we can consider that "native" really means the default built
in target that GDB supports, instead of saying that's the target that
debugs host native processes, if it turns out necessary.
This change doesn't affect users much, because "target child" results
in error today:
(gdb) target child
Use the "run" command to start a child process.
Other places "child" is visible:
(gdb) help target
...
List of target subcommands:
target child -- Child process (started by the "run" command)
target core -- Use a core file as a target
target exec -- Use an executable file as a target
...
(gdb) info target
Symbols from "/home/pedro/gdb/mygit/build/gdb/gdb".
Child process:
Using the running image of child Thread 0x7ffff7fc9740 (LWP 4818).
While running this, GDB does not access memory from...
...
These places will say "native" instead. I think that's a good thing.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* inf-child.c (inf_child_open): Remove mention of "child".
(inf_child_target): Rename target to "native" instead of "child".
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp: Test "target native" instead of "target
child".
Andreas Arnez [Fri, 22 Nov 2013 18:49:51 +0000 (18:49 +0000)]
Drop regset_alloc().
Now that all invocations of regset_alloc() have been removed, the
function is dropped. Since regset_alloc() was the only function
provided by regset.c, this source file is removed as well.
Andreas Arnez [Mon, 24 Feb 2014 10:58:15 +0000 (10:58 +0000)]
SPARC: Replace regset_alloc() invocations by static regset structures.
Andreas Arnez [Fri, 28 Mar 2014 17:34:19 +0000 (17:34 +0000)]
SPARC: Rename register maps from "*regset" to "*regmap"
Clear the naming confusion about "regset" versus "sparc*regset". The
latter was used to represent the *map* of a register set, not the
register set itself, and is thus renamed accordingly.
The following identifiers are renamed:
sparc32_bsd_fpregset => sparc32_bsd_fpregmap
sparc32_linux_core_gregset => sparc32_linux_core_gregmap
sparc32_sol2_fpregset => sparc32_sol2_fpregmap
sparc32_sol2_gregset => sparc32_sol2_gregmap
sparc32_sunos4_fpregset => sparc32_sunos4_fpregmap
sparc32_sunos4_gregset => sparc32_sunos4_gregmap
sparc32nbsd_gregset => sparc32nbsd_gregmap
sparc64_bsd_fpregset => sparc64_bsd_fpregmap
sparc64_linux_core_gregset => sparc64_linux_core_gregmap
sparc64_linux_ptrace_gregset => sparc64_linux_ptrace_gregmap
sparc64_sol2_fpregset => sparc64_sol2_fpregmap
sparc64_sol2_gregset => sparc64_sol2_gregmap
sparc64fbsd_gregset => sparc64fbsd_gregmap
sparc64nbsd_gregset => sparc64nbsd_gregmap
sparc64obsd_core_gregset => sparc64obsd_core_gregmap
sparc64obsd_gregset => sparc64obsd_gregmap
sparc_fpregset => sparc_fpregmap
sparc_gregset => sparc_gregmap
sparc_sol2_fpregset => sparc_sol2_fpregmap
sparc_sol2_gregset => sparc_sol2_gregmap
Also, all local variables 'gregset' and 'fpregset' are renamed to
'gregmap' and 'fpregmap', respectively.
Andreas Arnez [Mon, 31 Mar 2014 09:07:42 +0000 (09:07 +0000)]
SCORE: Replace regset_alloc() invocation by a static regset structure.
Since this changes makes the only member of the tdep structure
obsolete, the tdep structure is removed.
Andreas Arnez [Fri, 22 Nov 2013 18:43:00 +0000 (18:43 +0000)]
MN10300: Replace regset_alloc() invocations by static regset structures.
On this architecture the change may fix a small memory leak.
Andreas Arnez [Fri, 22 Nov 2013 18:40:06 +0000 (18:40 +0000)]
MIPS: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Mon, 5 May 2014 12:58:11 +0000 (12:58 +0000)]
X86: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Fri, 28 Mar 2014 17:21:39 +0000 (17:21 +0000)]
ARM: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.
Andreas Arnez [Fri, 22 Nov 2013 18:29:26 +0000 (18:29 +0000)]
AARCH64: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the tdep fields
'gregset' and 'fpregset' become obsolete and are thus removed.
Andreas Arnez [Tue, 13 May 2014 11:05:57 +0000 (11:05 +0000)]
Remove 'arch' field from regset structure.
Removes the 'arch' field from the regset structure, since it
represents the only "dynamic" data in a regset. It was referenced in
some regset supply- and collect routines, to get access to the gdbarch
associated with the regset. Naturally, the affected routines always
have access to the regcache to be supplied to or collected from. Thus
the gdbarch associated with that regcache can be used instead.
Andreas Arnez [Mon, 3 Mar 2014 09:31:21 +0000 (09:31 +0000)]
Constify regset structures.
Mark Wielaard [Wed, 21 May 2014 14:00:05 +0000 (16:00 +0200)]
gdb/testsuite: Handle underlying type in gdb.cp/var-tag.exp.
* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
Jan Kratochvil [Wed, 21 May 2014 14:25:53 +0000 (16:25 +0200)]
Fix TLS access for -static -pthread
I have posted:
TLS variables access for -static -lpthread executables
https://sourceware.org/ml/libc-help/2014-03/msg00024.html
and the GDB patch below has been confirmed as OK for current glibcs.
Further work should be done for newer glibcs:
Improve TLS variables glibc compatibility
https://sourceware.org/bugzilla/show_bug.cgi?id=16954
Still the patch below implements the feature in a fully functional way backward
compatible with current glibcs, it depends on the following glibc source line:
csu/libc-tls.c
main_map->l_tls_modid = 1;
gdb/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p.
(try_thread_db_load_1): Initialize it.
(thread_db_get_thread_local_address): Call it if LM is zero.
* target.c (target_translate_tls_address): Remove LM_ADDR zero check.
* target.h (struct target_ops) (to_get_thread_local_address): Add
load_module_addr comment.
gdb/gdbserver/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p.
(thread_db_get_tls_address): Call it if LOAD_MODULE is zero.
(thread_db_load_search, try_thread_db_load_1): Initialize it.
gdb/testsuite/
2014-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix TLS access for -static -pthread.
* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
<HAVE_TLS> (thread_function, main): Initialize it.
* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
Add clean_restart.
<$have_tls != "">: Check TLSVAR.
Message-ID: <
20140410115204.GB16411@host2.jankratochvil.net>
Pedro Alves [Wed, 21 May 2014 12:58:16 +0000 (13:58 +0100)]
Make the dcache (code/stack cache) handle line reading errors better
The dcache (code/stack cache) is supposed to be transparent, but it's
actually not in one case. dcache tries to read chunks (cache lines)
at a time off of the target. This may end up trying to read
unaccessible or unavailable memory. Currently the caller gets an xfer
error in this case. But if the specific bits of memory the caller
actually wanted are available and accessible, then the caller should
get the memory it wanted, not an error.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* dcache.c (dcache_read_memory_partial): If reading the cache line
fails, fallback to reading just the memory the caller wanted.
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/dcache-line-read-error.c: New.
* gdb.base/dcache-line-read-error.exp: New.
Alan Modra [Wed, 21 May 2014 00:01:09 +0000 (09:31 +0930)]
daily update
mfortune [Tue, 20 May 2014 22:50:21 +0000 (23:50 +0100)]
Add ChangeLog from previous MIPS .module commit
mfortune [Tue, 20 May 2014 12:28:20 +0000 (13:28 +0100)]
Add MIPS .module directive
gas/
* config/tc-mips.c (file_mips_opts_checked): New static global.
(s_module): New static function.
(file_ase): Remove.
(mips_pseudo_table): Add .module handler.
(mips_set_ase): Add opts argument and use instead of mips_opts.
(md_assemble): Use file_mips_check_options.
(md_parse_option): Update to use file_mips_opts instead of mips_opts.
(mips_set_architecture): Delete function. Moved to...
(mips_after_parse_args): Here. All logic now applies to
file_mips_opts first and then copies the final state to mips_opts.
Move error checking and defaults inference to mips_check_options and
file_mips_check_options.
(mips_check_options): New static function. Common option checking for
command line, .module and .set. Use .module values in error messages
instead of refering to command line options.
(file_mips_check_options): New static function. A wrapper for
mips_check_options with file_mips_opts. Updates BFD arch based on
final options.
(s_mipsset): Split into s_mipsset and parse_code_option. Settings
supported by both .set and .module are moved to parse_code_option.
Warnings and errors are kept in s_mipsset because when
parse_code_option is used with s_module the warnings are deferred
until code is generated. Any setting supporting 'default' value is
kept in s_mipsset as it is not applicable to s_module. Inferred
settings are also kept in s_mipsset as s_module does not infer any
settings. Use mips_check_options.
(parse_code_option): New static function derived from s_mipsset.
(s_module): New static function that implements .module. Allows file
level settings to be changed until code is generated.
(s_cpload, s_cpsetup, s_cplocal): Use file_mips_check_options.
(s_cprestore, s_cpreturn, s_cpadd, mips_address_bytes): Likewise.
(mips_elf_final_processing): Update file_ase to file_mips_opts.ase.
(md_mips_end): Use file_mips_check_options.
* doc/c-mips.texi: Document .module.
gas/testsuite
* gas/mips/mips.exp: Add new tests. Use 64-bit ABI for relax-bc1any.
Fix micromips arch definition to use mips64r2 consistently.
* gas/mips/module-defer-warn1.s: New.
* gas/mips/module-defer-warn1.d: New.
* gas/mips/module-defer-warn2.s: New.
* gas/mips/module-defer-warn2.l: New.
* gas/mips/module-override.d: New.
* gas/mips/module-override.s: New.
* gas/mips/mips-gp32-fp64.l: Update expected output.
* gas/mips/mips-gp64-fp32-pic.l: Update expected output.
* gas/mips/mips-gp64-fp32.l: Update expected output.
mfortune [Tue, 20 May 2014 22:34:19 +0000 (23:34 +0100)]
Remove newly introduced whitespace from warnings.
* messages.c (as_warn_internal): Remove extra whitespace from
warning messages.
mfortune [Tue, 20 May 2014 11:45:47 +0000 (12:45 +0100)]
Mark MSA as requiring FP64
gas/
* config/tc-mips.c (FP64_ASES): Add ASE_MSA.
(mips_after_parse_args): Do not select ASE_MSA without -mfp64.
gas/testsuite/
* gas/mips/micromips@msa-branch.d: Rework expected output for fp64.
* gas/mips/msa-branch.d: Likewise.
Hans-Peter Nilsson [Tue, 20 May 2014 21:13:08 +0000 (23:13 +0200)]
ld: Add missing eelf32mbel_linux.c to ALL_EMULATION_SOURCES.
ld:
* Makefile.am (ALL_EMULATION_SOURCES): Add missing eelf32mbel_linux.c.
* Makefile.in: Regenerate.
Doug Evans [Tue, 20 May 2014 20:06:26 +0000 (13:06 -0700)]
Fix gdb.multi/base.exp failures.
UNRESOLVED: gdb.multi/base.exp: remove-inferiors 2-3
UNRESOLVED: gdb.multi/base.exp: check remove-inferiors
gdb is crashing because it's accessing/freeing already freed memory.
==16368== Invalid read of size 4
==16368== at 0x660A9D: find_pc_section (binutils-gdb/gdb/objfiles.c:1349)
==16368== by 0x663ECB: lookup_minimal_symbol_by_pc_section (binutils-gdb/gdb/minsyms.c:734)
==16368== by 0x5D987A: find_pc_sect_symtab (binutils-gdb/gdb/symtab.c:2153)
==16368== by 0x5D4D77: blockvector_for_pc_sect (binutils-gdb/gdb/block.c:168)
==16368== by 0x5D4F59: block_for_pc_sect (binutils-gdb/gdb/block.c:246)
==16368== by 0x5D4F9B: block_for_pc (binutils-gdb/gdb/block.c:258)
==16368== by 0x734C5D: inline_frame_sniffer (binutils-gdb/gdb/inline-frame.c:218)
==16368== by 0x732104: frame_unwind_try_unwinder (binutils-gdb/gdb/frame-unwind.c:108)
==16368== by 0x73223F: frame_unwind_find_by_frame (binutils-gdb/gdb/frame-unwind.c:159)
==16368== by 0x72D5AA: compute_frame_id (binutils-gdb/gdb/frame.c:453)
==16368== by 0x7300EC: get_prev_frame_if_no_cycle (binutils-gdb/gdb/frame.c:1758)
==16368== by 0x73079A: get_prev_frame_always (binutils-gdb/gdb/frame.c:1931)
==16368== Address 0x5b13500 is 16 bytes inside a block of size 24 free'd
==16368== at 0x403072E: free (valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:445)
==16368== by 0x762134: xfree (binutils-gdb/gdb/common/common-utils.c:108)
==16368== by 0x65DACF: objfiles_pspace_data_cleanup (binutils-gdb/gdb/objfiles.c:91)
==16368== by 0x75E546: program_spaceregistry_callback_adaptor (binutils-gdb/gdb/progspace.c:45)
==16368== by 0x7644F6: registry_clear_data (binutils-gdb/gdb/registry.c:82)
==16368== by 0x7645AB: registry_container_free_data (binutils-gdb/gdb/registry.c:95)
==16368== by 0x75E5B4: program_space_free_data (binutils-gdb/gdb/progspace.c:45)
==16368== by 0x75E9BA: release_program_space (binutils-gdb/gdb/progspace.c:167)
==16368== by 0x75EB9B: prune_program_spaces (binutils-gdb/gdb/progspace.c:269)
==16368== by 0x75303D: remove_inferior_command (binutils-gdb/gdb/inferior.c:792)
==16368== by 0x50B5FD: do_cfunc (binutils-gdb/gdb/cli/cli-decode.c:107)
==16368== by 0x50E6F2: cmd_func (binutils-gdb/gdb/cli/cli-decode.c:1886)
The problem originates from the get_current_arch call in
py-progspace.c:py_free_pspace. The inferior associated with the
pspace is gone, and the current inferior is a different one and is running.
Therefore get_current_arch tries to read the current frame which
causes reads of data in the current program space which we've just deleted.
* python/py-progspace.c (py_free_pspace): Call target_gdbarch
instead of get_current_arch.