When sync_execution (a boolean) is true, it means we're running a
foreground command -- we hide the prompt stop listening to input, give
the inferior the terminal, then go to the event loop waiting for the
target to stop.
With multiple independent UIs, we need to track whether each UI is
synchronously blocked waiting for the target. IOW, if you do
"continue" in one console, that console stops accepting commands, but
you should still be free to type other commands in the others
consoles.
Just simply making sync_execution be per-UI alone not sufficient,
because of this in fetch_inferior_event:
/* If the inferior was in sync execution mode, and now isn't,
restore the prompt (a synchronous execution command has finished,
and we're ready for input). */
if (current_ui->async && was_sync && !sync_execution)
observer_notify_sync_execution_done ();
We'd have to record at entry the "was_sync" state for each UI, not
just of the current UI.
This patch instead replaces the sync_execution flag by a per-UI
tristate flag indicating the command line prompt state:
enum prompt_state
{
/* The command line is blocked simulating synchronous execution.
This is used to implement the foreground execution commands
('run', 'continue', etc.). We won't display the prompt and
accept further commands until the execution is actually over. */
PROMPT_BLOCKED,
/* The command finished; display the prompt before returning back to
the top level. */
PROMPT_NEEDED,
/* We've displayed the prompt already, ready for input. */
PROMPTED,
;
I think the end result is _much_ clearer than the current code, and,
it addresses the original motivation too.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* annotate.c: Include top.h.
(async_background_execution_p): Delete.
(print_value_flags): Check the UI's prompt state rather then
async_background_execution_p.
* event-loop.c (start_event_loop): Set the prompt state to
PROMPT_NEEDED.
* event-top.c (display_gdb_prompt, async_enable_stdin)
(async_disable_stdin): Check the current UI's prompt state instead
of the sync_execution global.
(command_line_handler): Set the prompt state to PROMPT_NEEDED
before running a command, and display the prompt if still needed
afterwards.
* infcall.c (struct call_thread_fsm) <waiting_ui>: New field.
(new_call_thread_fsm): New parameter 'waiting_ui'. Store it.
(call_thread_fsm_should_stop): Set the prompt state to
PROMPT_NEEDED.
(run_inferior_call): Adjust to temporarily set the prompt state to
PROMPT_BLOCKED instead of using the sync_execution global.
(call_function_by_hand_dummy): Pass the current UI to
new_call_thread_fsm.
* infcmd.c: Include top.h.
(continue_1): Check the current UI's prompt state instead of the
sync_execution global.
(continue_command): Validate global execution state before calling
prepare_execution_command.
(step_1): Call all_uis_check_sync_execution_done.
(attach_post_wait): Don't call async_enable_stdin here. Remove
reference to sync_execution.
* infrun.c (sync_execution): Delete global.
(follow_fork_inferior)
(reinstall_readline_callback_handler_cleanup): Check the current
UI's prompt state instead of the sync_execution global.
(check_curr_ui_sync_execution_done)
(all_uis_check_sync_execution_done): New functions.
(fetch_inferior_event): Call all_uis_check_sync_execution_done
instead of trying to determine whether the global sync execution
changed.
(handle_no_resumed): Check the prompt state of all UIs.
(normal_stop): Emit the no unwait-for even to all PROMPT_BLOCKED
UIs. Emit the "Switching to" notification to all UIs. Enable
stdin in all UIs.
* infrun.h (sync_execution): Delete.
(all_uis_check_sync_execution_done): Declare.
* main.c (captured_command_loop): Don't call
interp_pre_command_loop if the prompt is blocked.
(catch_command_errors, catch_command_errors_const): Adjust.
(captured_main): Set the initial prompt state to PROMPT_NEEDED.
* mi/mi-interp.c (display_mi_prompt): Set the prompt state to
PROMPTED.
(mi_interpreter_resume): Don't clear sync_execution. Remove hack
comment.
(mi_execute_command_input_handler): Set the prompt state to
PROMPT_NEEDED before executing the command, and only display the
prompt if the prompt state is PROMPT_NEEDED afterwards.
(mi_on_resume_1): Adjust to check the prompt state.
* target.c (target_terminal_inferior): Adjust to check the prompt
state.
* top.c (wait_sync_command_done, maybe_wait_sync_command_done)
(execute_command): Check the current UI's prompt state instead of
sync_execution.
* top.h (enum prompt_state): New.
(struct ui) <prompt_state>: New field.
(ALL_UIS): New macro.
Jan caught an intermittent GDB crash with the annota1.exp test:
Starting program: .../gdb/testsuite/gdb.base/annota1 ^M
[...]
FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
[...]
readline: readline_callback_read_char() called with no handler!^M
ERROR: Process no longer exists
All we need to is to continue the inferior in the foreground, and type
a command while the inferior is running. E.g.:
(gdb) set annotate 2
▒▒pre-prompt
(gdb)
▒▒prompt
c
▒▒post-prompt
Continuing.
▒▒starting
▒▒frames-invalid
*inferior is running now*
p 1<ret>
readline: readline_callback_read_char() called with no handler!
Aborted (core dumped)
$
When we run a foreground execution command we call
target_terminal_inferior to stop GDB from processing input, and to put
the inferior's terminal settings in effect. Then we tell readline to
hide the prompt with display_gdb_prompt, which clears readline's input
callback too. When the target stops, we call target_terminal_ours,
which re-installs stdin in the event loop, and then we redisplay the
prompt, reinstalling the readline callbacks.
However, when annotations are in effect, the "frames-invalid"
annotation code calls target_terminal_ours after 'resume' had already
called target_terminal_inferior:
(top-gdb) bt
#0 0x000000000056b82f in annotate_frames_invalid () at gdb/annotate.c:219
#1 0x000000000072e6cc in reinit_frame_cache () at gdb/frame.c:1705
#2 0x0000000000594bb9 in registers_changed_ptid (ptid=...) at gdb/regcache.c:612
#3 0x000000000064cca1 in target_resume (ptid=..., step=1, signal=GDB_SIGNAL_0) at gdb/target.c:2136
#4 0x00000000005f57af in resume (step=1, sig=GDB_SIGNAL_0) at gdb/infrun.c:2263
#5 0x00000000005f6051 in proceed (addr=18446744073709551615, siggnal=GDB_SIGNAL_DEFAULT, step=1) at gdb/infrun.c:2613
And then once we hide the prompt and remove readline's input handler
callback, we're in a bad state. We end up with the target running
supposedly in the foreground, but with stdin still installed on the
event loop. Any input then calls into readline, which aborts because
no rl_linefunc callback handler is installed:
Program received signal SIGABRT, Aborted.
0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(top-gdb) bt
#0 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x0000003b36a36f68 in __GI_abort () at abort.c:89
During symbol reading, debug info gives source 9 included from file at zero line 0.
During symbol reading, debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1.
#2 0x0000000000784a25 in rl_callback_read_char () at src/readline/callback.c:116
#3 0x0000000000619111 in rl_callback_read_char_wrapper (client_data=0x0) at src/gdb/event-top.c:167
#4 0x00000000006194e7 in stdin_event_handler (error=0, client_data=0x0) at src/gdb/event-top.c:373
#5 0x00000000006180da in handle_file_event (data=...) at src/gdb/event-loop.c:763
#6 0x00000000006175c1 in process_event () at src/gdb/event-loop.c:340
#7 0x0000000000617688 in gdb_do_one_event () at src/gdb/event-loop.c:404
#8 0x00000000006176d8 in start_event_loop () at src/gdb/event-loop.c:429
#9 0x0000000000619143 in cli_command_loop (data=0x0) at src/gdb/event-top.c:182
#10 0x000000000060f4c8 in current_interp_command_loop () at src/gdb/interps.c:318
#11 0x0000000000610691 in captured_command_loop (data=0x0) at src/gdb/main.c:323
#12 0x000000000060c385 in catch_errors (func=0x610676 <captured_command_loop>, func_args=0x0, errstring=0x900241 "", mask=RETURN_MASK_ALL)
at src/gdb/exceptions.c:237
#13 0x0000000000611b8f in captured_main (data=0x7fffffffd7b0) at src/gdb/main.c:1151
#14 0x000000000060c385 in catch_errors (func=0x610a8e <captured_main>, func_args=0x7fffffffd7b0, errstring=0x900241 "", mask=RETURN_MASK_ALL)
at src/gdb/exceptions.c:237
#15 0x0000000000611bb8 in gdb_main (args=0x7fffffffd7b0) at src/gdb/main.c:1159
#16 0x000000000045ef57 in main (argc=3, argv=0x7fffffffd8b8) at src/gdb/gdb.c:32
The fix is to make the annotation code call target_terminal_inferior
again after printing, if the inferior's settings were in effect.
While at it, when we're doing output only, instead of
target_terminal_ours, we should call target_terminal_ours_for_output.
The latter doesn't actually remove stdin from the event loop, and also
leaves SIGINT forwarded to the target.
New test included.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2014-10-17 Pedro Alves <palves@redhat.com>
PR gdb/17472
* annotate.c (annotate_breakpoints_invalid): Use
target_terminal_our_for_output instead of target_terminal_ours.
Give back the terminal to the target.
(annotate_frames_invalid): Likewise.
gdb/testsuite/
2014-10-17 Pedro Alves <palves@redhat.com>
PR gdb/17472
* gdb.base/annota-input-while-running.c: New file.
* gdb.base/annota-input-while-running.exp: New file.
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.
bothering the frontend about it... This is the exact same check MI
does.
I also smoke tested Emacs 23 in gud-gdb mode, both annotations=2
and annotations=3. I didn't notice anything break.
gdb/
2013-01-22 Pedro Alves <palves@redhat.com>
* annotate.c (breakpoint_changed): Skip if breakpoint is not
user-visible.
gdb/testsuite/
2013-01-22 Pedro Alves <palves@redhat.com>
* gdb.base/annota1.exp (signal sent): No longer expect
breakpoints-invalid.
* gdb.cp/annota2.exp (continue until exit)
(watch triggered on a.x): Ditto.
observer_notify_breakpoints_changed calls. All, except the
init_raw_breakpoint one. But that one is actually wrong. The
breakpoint is being constructed at that point, and hasn't been placed
on the breakpoint chain yet. It would be better placed in
install_breakpoint, and I actually started out that way. But once the
annotate_breakpoints_changed are parallel to the observer calls, we
can fully move annotations to observers too.
One issue is that this changes the order of annotations a bit.
Before, we'd emit the annotation, and after call "mention()" on the
breakpoint (which prints the breakpoint number, etc.). But, we call
the observers _after_ mention is called, so the annotation output will
change a little:
void
install_breakpoint (int internal, struct breakpoint *b, int update_gll)
{
add_to_breakpoint_chain (b);
set_breakpoint_number (internal, b);
if (is_tracepoint (b))
set_tracepoint_count (breakpoint_count);
if (!internal)
mention (b);
observer_notify_breakpoint_created (b);
if (update_gll)
update_global_location_list (1);
}
I believe this order doesn't really matter (the frontend needs to wait
for the prompt anyway), so I just adjust the expected output in the
tests. Emacs in annotations mode doesn't seem to complain. Couple
that with the previous patch that suppressed duplicated annotations,
and, the fact that some annotations calls were actually missing (were
we do have observer calls), more changes to the tests are needed
anyway.
Tested on x86_64 Fedora 17.
gdb/
2013-01-22 Pedro Alves <palves@redhat.com>
* annotate.c (annotate_breakpoints_changed): Rename to ...
(annotate_breakpoints_invalid): ... this. Make static.
(breakpoint_changed): Adjust.
(_initialize_annotate): Always install the observers. Install a
"breakpoint_created" observer.
* annotate.h (annotate_breakpoints_changed): Delete declaration.
* breakpoint.c (set_breakpoint_condition)
(breakpoint_set_commands, do_map_commands_command)
(init_raw_breakpoint, clear_command, set_ignore_count)
(enable_breakpoint_disp): No longer call
annotate_breakpoints_changed.
gdb/testsuite/
2013-01-22 Pedro Alves <palves@redhat.com>
* gdb.base/annota1.exp (breakpoints_invalid): New variable.
Adjust tests to breakpoints-invalid changes.
* gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New
variables.
Adjust tests to breakpoints-invalid changes.
handled, one of those being to place SSS breakpoints on the breakpoint
chain as all other breakpoints, annota1.exp times out with lots and
lots of breakpoint-invalid and frame-changed annotations. All those
extra annotations are actually unnecessary. For one, SSS breakpoints
are internal breakpoints, so the frontend shouldn't care if they were
added, removed or changed. Then, there's really no point in emitting
"breakpoints-invalid" or "frames-invalid" more than once between times
the frontend/user can actually issues GDB commands; the frontend will
have to wait for the GDB prompt to refresh its state, so emitting
those annotations at most once between prompts is enough. Non-stop or
async would complicate this, but no frontend will be using annotations
in those modes (one of goes of emacs switching to MI was non-stop mode
support, AFAIK). The previous patch reveals there has been an
intention in the past to suppress multiple breakpoints-invalid
annotations caused by ignore count changes. As the previous patch
shows, that's always been broken, but in any case, this patch actually
makes it work. The next patch will remove several annotation-specific
calls in breakpoint.c in favor of always using the breakpoint modified
& friends observers, and that causes yet more of these annotations,
because several calls to the corresponding annotate_* functions in
breakpoint.c are missing, particularly in newer code.
So all in all, here's a simple mechanism that avoids sending the same
annotation to the frontend more than once until gdb is ready to accept
further commands.
Tested on x86_64 Fedora 17.
2013-01-22 Pedro Alves <palves@redhat.com>
* annotate.c: Include "inferior.h".
(frames_invalid_emitted)
(breakpoints_invalid_emitted): New globals.
(async_background_execution_p): New function.
(annotate_breakpoints_changed, annotate_frames_invalid): Skip
emitting the annotation if it has already been emitted.
(annotate_display_prompt): New function.
* annotate.h (annotate_display_prompt): New declaration.
* event-top.c: Include annotate.h.
(display_gdb_prompt): Call annotate_display_prompt.
suppress multiple breakpoints-invalid annotations when the ignore
count of a breakpoint changes, up until the target actually stops.
But, the code is bogus:
void
annotate_breakpoints_changed (void)
{
if (annotation_level == 2)
{
target_terminal_ours ();
printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
if (ignore_count_changed)
ignore_count_changed = 0; /* Avoid multiple break annotations. */
}
}
The "ignore_count_changed" flag isn't actually guarding the output of
the annotation at all. It would have been better written something
like:
void
annotate_breakpoints_changed (void)
{
if (annotation_level == 2 && !ignore_count_changed)
{
target_terminal_ours ();
printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
ignore_count_changed = 0; /* Avoid multiple break annotations. */
}
}
but, it wasn't. AFAICS, that goes all the way back to the original
patch'es submission and check in, at
<http://sourceware.org/ml/gdb-patches/1999-q4/msg00106.html>. I
looked a tar of HP's wdb from 1999, and even though that contains
local changes in the annotate code, this suppression seems borked
there too to me.
The original patch added a test to supposedly exercise this
suppression, but, it actually doesn't. It merely tests that
"breakpoints-invalid" is output after "stopped", but doesn't check
whether the duplicates supression actually works (IOW, check that only
_one_ annotation is seen). I was going to simply delete the tests
too, but a following patch will eliminate the duplicates in a
different way (which I needed for a different reason), so instead, I'm
making the tests actually fail if a duplicate annotation is seen.
Worry not, the test doesn't actually fail! The reason is that
breakpoint.c does:
else if (b->ignore_count > 0)
{
b->ignore_count--;
annotate_ignore_count_change ();
bs->stop = 0;
/* Increase the hit count even though we don't stop. */
++(b->hit_count);
observer_notify_breakpoint_modified (b);
}
where the annotate_ignore_count_change call is meant to inform the
"breakpoint_modified" annotation observer to ignore the notification.
All sounds good. But, the trouble is that nowadays annotate.c only
installs the observers if GDB is started with annotations enabled with
a command line option (gdb --annotate=2):
void
_initialize_annotate (void)
{
if (annotation_level == 2)
{
observer_attach_breakpoint_deleted (breakpoint_changed);
observer_attach_breakpoint_modified (breakpoint_changed);
}
}
and annota1.exp, to enable annotations, starts GDB normally, and
afterwards does "set annotate 2", so the observers aren't installed
when annota1.exp is run, and therefore changing the ignore count isn't
triggering any annotation at all...
gdb/
2013-01-22 Pedro Alves <palves@redhat.com>
* annotate.c (ignore_count_changed): Delete.
(annotate_breakpoints_changed): Don't clear ignore_count_changed.
(annotate_ignore_count_change): Delete.
(annotate_stopped): Don't emit a delayed breakpoints-changed
annotation.
* annotate.h (annotate_ignore_count_change): Delete.
* breakpoint.c (bpstat_check_breakpoint_conditions): Don't call
annotate_ignore_count_change.
gdb/testsuite/
2013-01-22 Pedro Alves <palves@redhat.com>
* gdb.base/annota1.exp (annotate ignore count change): Add
expected output for failure case.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
(_initialize_annotate): Print breakpoints-invalid and
frames-invalid for level 2 annotations only.
* gdb.base/annota3.exp, gdb.cp/annota3.exp: The annotations
frames-invalid and breakpoints-invalid are no longer generated
with level 3 so don't expect them in the output.
* defs.h: Move _initialize_printcmd, _initialize_stack,
_initialize_blockframe out of here and in to their respective .c files.
* blockframe.c: Move _initialize_blockframe prototype to here.
* printcmd.c: Move _initialize_printcmd prototype to here.
* stack.c: Move _initialize_stack prototype to here.
* source.c, symtab.h: Move _initialize_source prototype to the .c file.
* values.c, value.h: Move _initialize_values prototype to the .c file.
* gdbthread.h, thread.c: Move _initialize_thread prototype to the .c
file.
* breakpoint.c, breakpoint.h: Move _initialize_breakpoint prototype
to the .c file.
* abug-rom.c alpha-nat.c alpha-tdep.c annotate.c ax-gdb.c bcache.c:
Standardize comments for the prototype section of these files.
* configure.in: Look in libc for wctype before looking for it in libc.
The last one is to fix the GNU ld (~2.9.1) + Solaris 2.6 interaction problem
where an empty stub library (libw) causes a core dump when we call vasprintf
(e.g. `info br') in the final linked gdb.
merged changes from Foundry (list follows by file/author):
- Tom Tromey <tromey@cygnus.com>
* Makefile.in (gdbres.o): New target.
(WINDRES): New define.
* configure: Rebuilt.
* configure.in (WINDRES): Define.
(CONFIG_OBS): Include gdbres.o on Windows.
* gdbtool.ico: New file.
* gdb.rc: New file.
* ser-unix.c
- Keith Seitz <keiths@onions.cygnus.com>
(wait_for): Don't reset the timeout_remaining for CYGWIN32,
since we now effectively poll the serial port.
Don't reset the current_timeout, either, since this member is used
by hardwire_readchar to track the timeout and call the ui_loop_hook.
(hardwire_readchar): Poll the serial port for Cygwin32. We timeout every
second, update the UI, and loop around doing this until we have hit the real
timeout or we get data or an error. This will allow the UI to stay active
while gdb is "blocked" talking to the target.
- Martin M. Hunt <hunt@cygnus.com>
(wait_for): Do reset current_timeout
because it is only used to keep track of what the
current timeout for the scb is.
* top.c
- Martin M. Hunt <hunt@cygnus.com>
(quit_confirm): Change exit message again
for GUI.
(pc_changed_hook): Add prototype.
- Tom Tromey <tromey@cygnus.com>
(quit_confirm): Added missing `else'.
(quit_confirm): Special-case message if init_ui_hook is
set.
* symtab.c
- Martin M. Hunt <hunt@cygnus.com>
(find_pc_sect_line): If no symbol information
is found, return correct pc anyway.
(find_methods): Comment out an apparently
bogus error message because it messes up Foundry.
* serial.c
- Martin M. Hunt <hunt@cygnus.com>
(_initialize_serial): Add a description of
"set remotelogbase".
* findvar.c
- Martin M. Hunt <hunt@cygnus.com>
(write_register_gen): Add call to
pc_changed_hook if the PC is being changed.
* defs.h
- Martin M. Hunt <hunt@cygnus.com>
(pc_changed_hook): Define.
* command.c
- Martin M. Hunt <hunt@cygnus.com>
(do_setshow_command): If no arguments are supplied,
don't dump core, instead print out an error message.
* breakpoint.c
- Martin M. Hunt <hunt@cygnus.com>
Make set_raw_breakpoint, set_breakpoint_count,
and breakpoint_count non-static so they are accessible from
gdbtk.c.
(enable_breakpoint): Enable breakpoint
with same disposition instead of changing all breakpoints
to donttouch.
* annotate.h
- Keith Seitz <keiths@onions.cygnus.com>
Add declarations for annotation hooks.
* annotate.c
- Keith Seitz <keiths@onions.cygnus.com>
Add hooks: annotate_starting_hook, annotate_stopped_hook,
annotate_signalled_hook, annotate_exited_hook.
(annotate_starting): If hook exists, call it instead.
(annotate_stopped): If hook exists, call it instead.
(annotate_exited): If hook exists, call it instead.
(annotate_signalled): If hook exists, call it instead.
Sat Mar 21 19:34:49 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
Merged changes from Foundry: list follows by author:
- Tom Tromey <tromey@cygnus.com>
* Makefile.in (gdbres.o): New target.
(WINDRES): New define.
* configure: Rebuilt.
* configure.in (WINDRES): Define.
(CONFIG_OBS): Include gdbres.o on Windows.
* gdbtool.ico: New file.
* gdb.rc: New file.
* gdbtk.c (gdbtk_init): Call ide_create_messagebox_command.
(gdbtk_cleanup): Call ide_interface_deregister_all.
(gdbtk_init): Pass event handle to cleanup.
(TclDebug): Use Tcl_Merge to construct command.
(gdbtk_init): Call ide_create_cygwin_path_command.
- Martin M. Hunt <hunt@cygnus.com>
* gdbtk.c (gdb_set_bp): Set addr_string for bp.
(gdb_get_breakpoint_info): Demangle function
names in breakpoint info.
Include "demangle.h".
(gdb_loc, gdb_listfuncs): Demangle C++
function names.
(gdb_set_bp): Properly quote filename to fix
problems with spaces. Send pc back as a hex string.
(gdb_listfuncs): Remove debugging line.
Turn off some debugging lines.
(breakpoint_notify): Return correct line number.
(gdb_get_breakpoint_info): Return correct line number.
(gdb_set_bp): New function to provide a better way to
set breakpoints.
(gdbtk_readline, gdbtk_readline_begin): Memory
allocated by tcl needs to be freed by Tcl_Free().
(find_file_in_dir): Deleted.
(gdb_find_file_command): Call full_lookup_symtab().
(gdb_listfuncs): Call full_lookup_symtab().
(full_lookup_symtab): New function. Like lookup_symtab
except handles multiple files with the same basename,
full pathnames, and always sets symtab->fullname.
(gdb_loadfile): Call full_lookup_symtab(). Clear
realloc'd memory.
(gdb_loadfile): Don't tag lines without source.
Tag source lines with source_tag.
(gdb_find_file_command, find_file_in_dir):
Rewrite. Now searches symtabs and psymtabs for a match
on the partial or full filename. Returns the full pathname.
(gdb_loadfile): Realloc additional memory
if someone loads in a file with more than 160,000
lines. I don't know if this really works because
I don't have enough memory to test it.
(gdb_sourcelines): Deleted.
(gdb_loadfile): New function. Takes a text widget
and loads it with the contents of a file. Marks
and tags source lines.
(pc_changed): New function.
(get_pc_register): Returns the value of
the PC to GDB.
(gdb_loc): If looking on the stack, return
real pc along with calling source line.
(gdb_loc): Return "" instead of "N/A" if
filename is not found.
(gdb_get_breakpoint_info): Same.
(get_register): For Natural mode, set format to 0.
Minor bugfixes from keiths.
(TclDebug): New function for debugging use.
(gdb_loc): Return correct PC for frames
that are not the innermost frame.
(gdb_listfiles): Rewritten to use object
API. Now takes an optional dirname which will cause
only files in that directory or its subdirectories
to be returned. Now returns basenames instead of
full pathnames.
(gdb_cmd): Set/reset load_in_progress flag.
(call_wrapper): Don't pop up dialog for errors in
downloads; just abort download.
(gdbtk_load_hash): Set return value correctly.
- Keith Seitz <keiths@onions.cygnus.com>
* gdbtk.c (gdbtk_init): Define the ui_loop_hook so that it can be
called by routines which might block, allowing us to update the GUI.
(gdbtk_wait): Move timer calls to annotation hooks.
(gdbtk_init): Define the annotation hooks.
(gdbtk_annotate_starting): New function for cygwin32 hosts.
(gdbtk_annotate_stopped): New function for cygwin32 hosts.
(gdbtk_annotate_exited): New function for cygwin32 hosts.
(gdbtk_annotate_signalled): New function. for cygwin32 hosts.
(gdbtk_init): Use gdbtk_print_frame_info hook.
(gdbtk_print_frame_info): New function which sets current_source_symtab
based on the given symtab and line info.
(gdb_immediate_command): New function which does
not buffer any
output. (Contrast to gdb_cmd.)
(gdb_prompt_command): New function to return gdb's prompt.
(find_file_in_dir): New functon which searches source paths
for a given filename.
(gdb_find_file): New function which returns path to given file -- uses
find_file_in_dir.
(gdbtk_init): Install "gdb_immediate", "gdb_find_file", and
"gdb_prompt"
commands into interpreter.
- Ian Lance Taylor <ian@cygnus.com>
* gdbtk.c (gdbtk_timer_going): If __CYGWIN32__, new static
variable.
(gdb_cmd): If __CYGWIN32__, if executing the load command, call
gdbtk_start_timer and gdbtk_stop_timer.
(call_wrapper): If __CYGWIN32__, if the timer is going, turn it
off. Clear load_in_progress.
(x_event): If load_in_progress, quit if download_cancel_ok.
(gdbtk_start_timer): Set gdbtk_timer_going.
(gdbtk_stop_timer): Clear gdbtk_timer_going.
(gdbtk_wait): Call x_event.
(gdbtk_init): Call ide_create_win_grab_command if
__CYGIN32__.
(gdb_clear_file): Clear stop_pc.
`0x' prefix for the pc value, to remain consistent with previous
GDB versions.
* blockframe.c (find_pc_partial_function), config/pa/tm-hppa.h:
Remove Sun shared library transfer hack and
INHIBIT_SUNSOLIB_TRANSFER_TABLE_HACK, it is obsoleted by the
mst_solib_trampoline minimal symbols.
* blockframe.c (inside_main_func): Check main_func_*pc against
INVALID_ENTRY_*PC, not zero.
* symfile.c (init_entry_point_info): Initialize ei.*pc with
INVALID_ENTRY_*PC.
* mipsread.c (mipscoff_symfile_read): If the entry_file bounds
are still unknown after processing the partial symbols, then try
to set them from the minimal symbols.
* infcmd.c (registers_info): Error out if selected_frame is NULL.
* stack.c (return_command): Select new current frame silently if
not interactive.
* mipsread.c (read_alphacoff_dynamic_symtab): Ignore additional
DT_MIPS_LOCAL_GOTNO and DT_MIPS_GOTSYM entries.
* irix5-nat.c (solib_create_inferior_hook): Call solib_add only
if auto_solib_add_at_startup is nonzero.
(_initialize_solib): Add "set auto-solib-add" command.
* osfsolib.c (solib_create_inferior_hook): Call solib_add only
if auto_solib_add_at_startup is nonzero.
(_initialize_solib): Add "set auto-solib-add" command.