GDB (xrefs)
Loading...
Searching...
No Matches
mi-interp.c
Go to the documentation of this file.
1/* MI Interpreter Definitions and Commands for GDB, the GNU debugger.
2
3 Copyright (C) 2002-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21
22#include "mi-interp.h"
23
24#include "interps.h"
25#include "event-top.h"
26#include "gdbsupport/event-loop.h"
27#include "inferior.h"
28#include "infrun.h"
29#include "ui-out.h"
30#include "ui.h"
31#include "mi-main.h"
32#include "mi-cmds.h"
33#include "mi-out.h"
34#include "mi-console.h"
35#include "mi-common.h"
36#include "observable.h"
37#include "gdbthread.h"
38#include "solist.h"
39#include "objfiles.h"
40#include "tracepoint.h"
41#include "cli-out.h"
42#include "thread-fsm.h"
43#include "cli/cli-interp.h"
44#include "gdbsupport/scope-exit.h"
45
46/* These are the interpreter setup, etc. functions for the MI
47 interpreter. */
48
49static void mi_execute_command_wrapper (const char *cmd);
51 (gdb::unique_xmalloc_ptr<char> &&cmd);
52
53/* These are hooks that we put in place while doing interpreter_exec
54 so we can report interesting things that happened "behind the MI's
55 back" in this command. */
56
57static int mi_interp_query_hook (const char *ctlstr, va_list ap)
58 ATTRIBUTE_PRINTF (1, 0);
59
60static void mi_insert_notify_hooks (void);
61static void mi_remove_notify_hooks (void);
62
63/* Display the MI prompt. */
64
65static void
67{
68 struct ui *ui = current_ui;
69
70 gdb_puts ("(gdb) \n", mi->raw_stdout);
73}
74
75void
80
81void
82mi_interp::init (bool top_level)
83{
84 mi_interp *mi = this;
85
86 /* Store the current output channel, so that we can create a console
87 channel that encapsulates and prefixes all gdb_output-type bits
88 coming from the rest of the debugger. */
90
91 /* Create MI console channels, each with a different prefix so they
92 can be distinguished. */
93 mi->out = new mi_console_file (mi->raw_stdout, "~", '"');
94 mi->err = new mi_console_file (mi->raw_stdout, "&", '"');
95 mi->log = mi->err;
96 mi->targ = new mi_console_file (mi->raw_stdout, "@", '"');
97 mi->event_channel = new mi_console_file (mi->raw_stdout, "=", 0);
98 mi->mi_uiout = mi_out_new (name ()).release ();
99 gdb_assert (mi->mi_uiout != nullptr);
100 mi->cli_uiout = new cli_ui_out (mi->out);
101
102 if (top_level)
103 {
104 /* The initial inferior is created before this function is called, so we
105 need to report it explicitly when initializing the top-level MI
106 interpreter.
107
108 This is also called when additional MI interpreters are added (using
109 the new-ui command), when multiple inferiors possibly exist, so we need
110 to use iteration to report all the inferiors. */
111
112 for (inferior *inf : all_inferiors ())
114 }
115}
116
117void
119{
120 struct mi_interp *mi = this;
121 struct ui *ui = current_ui;
122
123 /* As per hack note in mi_interpreter_init, swap in the output
124 channels... */
126
129
130 gdb_stdout = mi->out;
131 /* Route error and log output through the MI. */
132 gdb_stderr = mi->err;
133 gdb_stdlog = mi->log;
134 /* Route target output through the MI. */
135 gdb_stdtarg = mi->targ;
136 /* Route target error through the MI as well. */
137 gdb_stdtargerr = mi->targ;
138
140}
141
142void
147
148void
149mi_interp::exec (const char *command)
150{
152}
153
154void
155mi_cmd_interpreter_exec (const char *command, const char *const *argv,
156 int argc)
157{
158 struct interp *interp_to_use;
159 int i;
160
161 if (argc < 2)
162 error (_("-interpreter-exec: "
163 "Usage: -interpreter-exec interp command"));
164
165 interp_to_use = interp_lookup (current_ui, argv[0]);
166 if (interp_to_use == NULL)
167 error (_("-interpreter-exec: could not find interpreter \"%s\""),
168 argv[0]);
169
170 /* Note that unlike the CLI version of this command, we don't
171 actually set INTERP_TO_USE as the current interpreter, as we
172 still want gdb_stdout, etc. to point at MI streams. */
173
174 /* Insert the MI out hooks, making sure to also call the
175 interpreter's hooks if it has any. */
176 /* KRS: We shouldn't need this... Events should be installed and
177 they should just ALWAYS fire something out down the MI
178 channel. */
180
181 /* Now run the code. */
182
183 SCOPE_EXIT
184 {
186 };
187
188 for (i = 1; i < argc; i++)
189 interp_exec (interp_to_use, argv[i]);
190}
191
192/* This inserts a number of hooks that are meant to produce
193 async-notify ("=") MI messages while running commands in another
194 interpreter using mi_interpreter_exec. The canonical use for this
195 is to allow access to the gdb CLI interpreter from within the MI,
196 while still producing MI style output when actions in the CLI
197 command change GDB's state. */
198
199static void
204
205static void
210
211static int
212mi_interp_query_hook (const char *ctlstr, va_list ap)
213{
214 return 1;
215}
216
217static void
219{
220 struct ui *ui = current_ui;
221
223}
224
225void
227{
228 /* If MI is sync, then output the MI prompt now, indicating we're
229 ready for further input. */
230 if (!mi_async_p ())
231 display_mi_prompt (this);
232}
233
234/* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER. */
235
236static void
237mi_execute_command_input_handler (gdb::unique_xmalloc_ptr<char> &&cmd)
238{
240 struct ui *ui = current_ui;
241
243
244 mi_execute_command_wrapper (cmd.get ());
245
246 /* Print a prompt, indicating we're ready for further input, unless
247 we just started a synchronous command. In that case, we're about
248 to go back to the event loop and will output the prompt in the
249 'synchronous_command_done' observer when the target next
250 stops. */
253}
254
255void
257{
258 struct mi_interp *mi = this;
259
260 /* Turn off 8 bit strings in quoted output. Any character with the
261 high bit set is printed using C's octal format. */
263
264 /* Tell the world that we're alive. */
266}
267
268void
270{
273
274 gdb_printf (this->event_channel, "thread-created,id=\"%d\",group-id=\"i%d\"",
275 t->global_num, t->inf->num);
276 gdb_flush (this->event_channel);
277}
278
279void
281 gdb::optional<ULONGEST> /* exit_code */,
282 int /* silent */)
283{
286 gdb_printf (this->event_channel, "thread-exited,id=\"%d\",group-id=\"i%d\"",
287 t->global_num, t->inf->num);
288 gdb_flush (this->event_channel);
289}
290
291void
293 const char *method, const char *format)
294{
297
298 if (started)
299 {
300 if (format != NULL)
302 "record-started,thread-group=\"i%d\","
303 "method=\"%s\",format=\"%s\"",
304 inferior->num, method, format);
305 else
307 "record-started,thread-group=\"i%d\","
308 "method=\"%s\"",
309 inferior->num, method);
310 }
311 else
313 "record-stopped,thread-group=\"i%d\"",
314 inferior->num);
315
316 gdb_flush (this->event_channel);
317}
318
319void
321{
324
325 gdb_printf (this->event_channel, "thread-group-added,id=\"i%d\"", inf->num);
326 gdb_flush (this->event_channel);
327}
328
329void
331{
334
335 gdb_printf (this->event_channel, "thread-group-started,id=\"i%d\",pid=\"%d\"",
336 inf->num, inf->pid);
337 gdb_flush (this->event_channel);
338}
339
340void
342{
345
346 if (inf->has_exit_code)
348 "thread-group-exited,id=\"i%d\",exit-code=\"%s\"",
349 inf->num, int_string (inf->exit_code, 8, 0, 0, 1));
350 else
352 "thread-group-exited,id=\"i%d\"", inf->num);
353
354 gdb_flush (this->event_channel);
355}
356
357void
359{
362
363 gdb_printf (this->event_channel, "thread-group-removed,id=\"i%d\"", inf->num);
364 gdb_flush (this->event_channel);
365}
366
367/* Observers for several run control events that print why the
368 inferior has stopped to both the MI event channel and to the MI
369 console. If the MI interpreter is not active, print nothing. */
370
371void
372mi_interp::on_signal_received (enum gdb_signal siggnal)
373{
374 print_signal_received_reason (this->mi_uiout, siggnal);
376}
377
378void
380{
383}
384
385void
387{
388 print_exited_reason (this->mi_uiout, status);
389 print_exited_reason (this->cli_uiout, status);
390}
391
392void
398
399void
401{
402 /* Since this can be called when CLI command is executing,
403 using cli interpreter, be sure to use MI uiout for output,
404 not the current one. */
405 ui_out *mi_uiout = this->interp_ui_out ();
406
407 if (print_frame)
408 {
410
411 if (tp->thread_fsm () != nullptr
412 && tp->thread_fsm ()->finished_p ())
413 {
414 async_reply_reason reason
415 = tp->thread_fsm ()->async_reply_reason ();
416 mi_uiout->field_string ("reason", async_reason_lookup (reason));
417 }
418
419 interp *console_interp = interp_lookup (current_ui, INTERP_CONSOLE);
420
421 /* We only want to print the displays once, and we want it to
422 look just how it would on the console, so we use this to
423 decide whether the MI stop should include them. */
424 bool console_print = should_print_stop_to_console (console_interp, tp);
425 print_stop_event (mi_uiout, !console_print);
426
427 if (console_print)
429
430 mi_uiout->field_signed ("thread-id", tp->global_num);
431 if (non_stop)
432 {
433 ui_out_emit_list list_emitter (mi_uiout, "stopped-threads");
434
435 mi_uiout->field_signed (NULL, tp->global_num);
436 }
437 else
438 mi_uiout->field_string ("stopped-threads", "all");
439
440 int core = target_core_of_thread (tp->ptid);
441 if (core != -1)
442 mi_uiout->field_signed ("core", core);
443 }
444
445 gdb_puts ("*stopped", this->raw_stdout);
446 mi_out_put (mi_uiout, this->raw_stdout);
447 mi_out_rewind (mi_uiout);
449 gdb_puts ("\n", this->raw_stdout);
450 gdb_flush (this->raw_stdout);
451}
452
453void
455{
456 /* Suppress output while calling an inferior function. */
457
458 if (inferior_ptid != null_ptid)
459 {
460 struct thread_info *tp = inferior_thread ();
461
462 if (tp->control.in_infcall)
463 return;
464 }
465
466 this->mi_proceeded = 1;
467}
468
469/* When the element is non-zero, no MI notifications will be emitted in
470 response to the corresponding observers. */
471
472struct mi_suppress_notification mi_suppress_notification =
473 {
474 0,
475 0,
476 0,
477 0,
478 };
479
480void
482{
484 return;
485
488
489 if (tfnum >= 0)
490 gdb_printf (this->event_channel, "traceframe-changed,"
491 "num=\"%d\",tracepoint=\"%d\"",
492 tfnum, tpnum);
493 else
494 gdb_printf (this->event_channel, "traceframe-changed,end");
495
496 gdb_flush (this->event_channel);
497}
498
499void
501{
504
505 gdb_printf (this->event_channel, "tsv-created,"
506 "name=\"%s\",initial=\"%s\"",
507 tsv->name.c_str (), plongest (tsv->initial_value));
508
509 gdb_flush (this->event_channel);
510}
511
512void
514{
517
518 if (tsv != nullptr)
519 gdb_printf (this->event_channel, "tsv-deleted,name=\"%s\"",
520 tsv->name.c_str ());
521 else
522 gdb_printf (this->event_channel, "tsv-deleted");
523
524 gdb_flush (this->event_channel);
525}
526
527void
529{
530 ui_out *mi_uiout = this->interp_ui_out ();
531
534
536 "tsv-modified");
537
539
540 mi_uiout->field_string ("name", tsv->name);
541 mi_uiout->field_string ("initial",
542 plongest (tsv->initial_value));
543 if (tsv->value_known)
544 mi_uiout->field_string ("current", plongest (tsv->value));
545
546 gdb_flush (this->event_channel);
547}
548
549/* Print breakpoint BP on MI's event channel. */
550
551static void
553{
554 ui_out *mi_uiout = mi->interp_ui_out ();
555
556 /* We want the output from print_breakpoint to go to
557 mi->event_channel. One approach would be to just call
558 print_breakpoint, and then use mi_out_put to send the current
559 content of mi_uiout into mi->event_channel. However, that will
560 break if anything is output to mi_uiout prior to calling the
561 breakpoint_created notifications. So, we use
562 ui_out_redirect. */
563 ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
564
565 try
566 {
567 scoped_restore restore_uiout
568 = make_scoped_restore (&current_uiout, mi_uiout);
569
571 }
572 catch (const gdb_exception_error &ex)
573 {
575 }
576}
577
578void
580{
582 return;
583
584 if (b->number <= 0)
585 return;
586
589
590 gdb_printf (this->event_channel, "breakpoint-created");
592
593 gdb_flush (this->event_channel);
594}
595
596void
598{
600 return;
601
602 if (b->number <= 0)
603 return;
604
607
608 gdb_printf (this->event_channel, "breakpoint-deleted,id=\"%d\"", b->number);
609 gdb_flush (this->event_channel);
610}
611
612void
614{
616 return;
617
618 if (b->number <= 0)
619 return;
620
623 gdb_printf (this->event_channel, "breakpoint-modified");
625
626 gdb_flush (this->event_channel);
627}
628
629static void
631{
633 {
635
636 if (mi == NULL)
637 continue;
638
640 "*running,thread-id=\"%d\"\n",
641 thread->global_num);
642 }
643}
644
645/* Return true if there are multiple inferiors loaded. This is used
646 for backwards compatibility -- if there's only one inferior, output
647 "all", otherwise, output each resumed thread individually. */
648
649static bool
651{
652 int count = 0;
653 for (inferior *inf ATTRIBUTE_UNUSED : all_non_exited_inferiors ())
654 {
655 count++;
656 if (count > 1)
657 return true;
658 }
659
660 return false;
661}
662
663static void
665 process_stratum_target *targ, ptid_t ptid)
666{
667 /* To cater for older frontends, emit ^running, but do it only once
668 per each command. We do it here, since at this point we know
669 that the target was successfully resumed, and in non-async mode,
670 we won't return back to MI interpreter code until the target
671 is done running, so delaying the output of "^running" until then
672 will make it impossible for frontend to know what's going on.
673
674 In future (MI3), we'll be outputting "^done" here. */
676 {
677 gdb_printf (mi->raw_stdout, "%s^running\n",
678 mi->current_token ? mi->current_token : "");
679 }
680
681 /* Backwards compatibility. If doing a wildcard resume and there's
682 only one inferior, output "all", otherwise, output each resumed
683 thread individually. */
684 if ((ptid == minus_one_ptid || ptid.is_pid ())
686 gdb_printf (mi->raw_stdout, "*running,thread-id=\"all\"\n");
687 else
688 for (thread_info *tp : all_non_exited_threads (targ, ptid))
690
692 {
694 /* This is what gdb used to do historically -- printing prompt
695 even if it cannot actually accept any input. This will be
696 surely removed for MI3, and may be removed even earlier. */
698 gdb_puts ("(gdb) \n", mi->raw_stdout);
699 }
700 gdb_flush (mi->raw_stdout);
701}
702
703void
705{
706 struct thread_info *tp = NULL;
707
709 if (ptid == minus_one_ptid || ptid.is_pid ())
710 tp = inferior_thread ();
711 else
712 tp = target->find_thread (ptid);
713
714 /* Suppress output while calling an inferior function. */
715 if (tp->control.in_infcall)
716 return;
717
720
721 mi_on_resume_1 (this, target, ptid);
722}
723
724/* See mi-interp.h. */
725
726void
728{
729 struct gdbarch *gdbarch = target_gdbarch ();
730
731 uiout->field_string ("id", solib->so_original_name);
732 uiout->field_string ("target-name", solib->so_original_name);
733 uiout->field_string ("host-name", solib->so_name);
734 uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
736 uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
737
738 ui_out_emit_list list_emitter (uiout, "ranges");
739 ui_out_emit_tuple tuple_emitter (uiout, NULL);
740 if (solib->addr_high != 0)
741 {
742 uiout->field_core_addr ("from", gdbarch, solib->addr_low);
743 uiout->field_core_addr ("to", gdbarch, solib->addr_high);
744 }
745}
746
747void
749{
750 ui_out *uiout = this->interp_ui_out ();
751
754
755 gdb_printf (this->event_channel, "library-loaded");
756
757 ui_out_redirect_pop redir (uiout, this->event_channel);
758
759 mi_output_solib_attribs (uiout, solib);
760
761 gdb_flush (this->event_channel);
762}
763
764void
766{
767 ui_out *uiout = this->interp_ui_out ();
768
771
772 gdb_printf (this->event_channel, "library-unloaded");
773
774 ui_out_redirect_pop redir (uiout, this->event_channel);
775
776 uiout->field_string ("id", solib->so_original_name);
777 uiout->field_string ("target-name", solib->so_original_name);
778 uiout->field_string ("host-name", solib->so_name);
780 uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
781
782 gdb_flush (this->event_channel);
783}
784
785void
786mi_interp::on_param_changed (const char *param, const char *value)
787{
789 return;
790
791 ui_out *mi_uiout = this->interp_ui_out ();
792
795
796 gdb_printf (this->event_channel, "cmd-param-changed");
797
799
800 mi_uiout->field_string ("param", param);
801 mi_uiout->field_string ("value", value);
802
803 gdb_flush (this->event_channel);
804}
805
806void
808 ssize_t len, const bfd_byte *myaddr)
809{
811 return;
812
813
814 ui_out *mi_uiout = this->interp_ui_out ();
815
818
819 gdb_printf (this->event_channel, "memory-changed");
820
822
823 mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
824 mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
825 mi_uiout->field_string ("len", hex_string (len));
826
827 /* Append 'type=code' into notification if MEMADDR falls in the range of
828 sections contain code. */
829 obj_section *sec = find_pc_section (memaddr);
830 if (sec != nullptr && sec->objfile != nullptr)
831 {
832 flagword flags = bfd_section_flags (sec->the_bfd_section);
833
834 if (flags & SEC_CODE)
835 mi_uiout->field_string ("type", "code");
836 }
837
838 gdb_flush (this->event_channel);
839}
840
841void
843{
844 /* Don't send an event if we're responding to an MI command. */
846 return;
847
848 thread_info *tp = inferior_ptid != null_ptid ? inferior_thread () : nullptr;
849 ui_out *mi_uiout = this->interp_ui_out ();
850 ui_out_redirect_pop redirect_popper (mi_uiout, this->event_channel);
851
854
855 if (selection & USER_SELECTED_INFERIOR)
857
858 if (tp != NULL
859 && (selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME)))
860 {
861 print_selected_thread_frame (this->cli_uiout, selection);
862
863 gdb_printf (this->event_channel, "thread-selected,id=\"%d\"",
864 tp->global_num);
865
866 if (tp->state != THREAD_RUNNING)
867 {
868 if (has_stack_frames ())
870 1, SRC_AND_LOC, 1);
871 }
872 }
873
874 gdb_flush (this->event_channel);
875}
876
877ui_out *
879{
880 return this->mi_uiout;
881}
882
883/* Do MI-specific logging actions; save raw_stdout, and change all
884 the consoles to use the supplied ui-file(s). */
885
886void
888 bool debug_redirect)
889{
890 struct mi_interp *mi = this;
891
892 if (logfile != NULL)
893 {
895
896 ui_file *logfile_p = logfile.get ();
897 mi->logfile_holder = std::move (logfile);
898
899 /* If something is not being redirected, then a tee containing both the
900 logfile and stdout. */
901 ui_file *tee = nullptr;
903 {
904 tee = new tee_file (mi->raw_stdout, logfile_p);
905 mi->stdout_holder.reset (tee);
906 }
907
908 mi->raw_stdout = logging_redirect ? logfile_p : tee;
909 }
910 else
911 {
912 mi->logfile_holder.reset ();
913 mi->stdout_holder.reset ();
915 mi->saved_raw_stdout = nullptr;
916 }
917
918 mi->out->set_raw (mi->raw_stdout);
919 mi->err->set_raw (mi->raw_stdout);
920 mi->log->set_raw (mi->raw_stdout);
921 mi->targ->set_raw (mi->raw_stdout);
923}
924
925/* Factory for MI interpreters. */
926
927static struct interp *
929{
930 return new mi_interp (name);
931}
932
934void
const char *const name
struct gdbarch * target_gdbarch(void)
void print_breakpoint(breakpoint *b)
struct process_stratum_target * process_target()
Definition inferior.h:449
int num
Definition inferior.h:557
const char * name() const
Definition interps.h:87
void set_raw(ui_file *raw)
Definition mi-console.c:103
mi_console_file * log
Definition mi-interp.h:80
void on_user_selected_context_changed(user_selected_what selection) override
Definition mi-interp.c:842
void on_solib_unloaded(so_list *so) override
Definition mi-interp.c:765
ui_out * interp_ui_out() override
Definition mi-interp.c:878
void on_inferior_removed(inferior *inf) override
Definition mi-interp.c:358
void on_param_changed(const char *param, const char *value) override
Definition mi-interp.c:786
void on_tsv_created(const trace_state_variable *tsv) override
Definition mi-interp.c:500
void pre_command_loop() override
Definition mi-interp.c:256
void on_solib_loaded(so_list *so) override
Definition mi-interp.c:748
void on_new_thread(thread_info *t) override
Definition mi-interp.c:269
mi_console_file * out
Definition mi-interp.h:78
void on_command_error() override
Definition mi-interp.c:76
void suspend() override
Definition mi-interp.c:143
void on_sync_execution_done() override
Definition mi-interp.c:226
void on_target_resumed(ptid_t ptid) override
Definition mi-interp.c:704
void on_traceframe_changed(int tfnum, int tpnum) override
Definition mi-interp.c:481
void on_thread_exited(thread_info *t, gdb::optional< ULONGEST > exit_code, int silent) override
Definition mi-interp.c:280
void on_about_to_proceed() override
Definition mi-interp.c:454
mi_console_file * event_channel
Definition mi-interp.h:82
struct ui_out * mi_uiout
Definition mi-interp.h:95
struct ui_out * cli_uiout
Definition mi-interp.h:98
void on_breakpoint_deleted(breakpoint *b) override
Definition mi-interp.c:597
ui_file_up stdout_holder
Definition mi-interp.h:92
mi_console_file * targ
Definition mi-interp.h:81
void exec(const char *command_str) override
Definition mi-interp.c:149
void resume() override
Definition mi-interp.c:118
void on_exited(int status) override
Definition mi-interp.c:386
void on_tsv_modified(const trace_state_variable *tsv) override
Definition mi-interp.c:528
struct ui_file * raw_stdout
Definition mi-interp.h:85
struct ui_file * saved_raw_stdout
Definition mi-interp.h:90
void on_inferior_added(inferior *inf) override
Definition mi-interp.c:320
void on_signal_exited(gdb_signal sig) override
Definition mi-interp.c:379
void set_logging(ui_file_up logfile, bool logging_redirect, bool debug_redirect) override
Definition mi-interp.c:887
void on_record_changed(inferior *inf, int started, const char *method, const char *format) override
Definition mi-interp.c:292
void on_inferior_appeared(inferior *inf) override
Definition mi-interp.c:330
void on_tsv_deleted(const trace_state_variable *tsv) override
Definition mi-interp.c:513
void on_inferior_disappeared(inferior *inf) override
Definition mi-interp.c:341
ui_file_up logfile_holder
Definition mi-interp.h:91
void on_breakpoint_created(breakpoint *b) override
Definition mi-interp.c:579
const char * current_token
Definition mi-interp.h:106
void on_signal_received(gdb_signal sig) override
Definition mi-interp.c:372
void on_breakpoint_modified(breakpoint *b) override
Definition mi-interp.c:613
void on_normal_stop(struct bpstat *bs, int print_frame) override
Definition mi-interp.c:400
int running_result_record_printed
Definition mi-interp.h:100
void on_no_history() override
Definition mi-interp.c:393
void on_memory_changed(inferior *inf, CORE_ADDR addr, ssize_t len, const bfd_byte *data) override
Definition mi-interp.c:807
void init(bool top_level) override
Definition mi-interp.c:82
mi_console_file * err
Definition mi-interp.h:79
int mi_proceeded
Definition mi-interp.h:104
thread_info * find_thread(ptid_t ptid)
static void ours_for_output()
Definition target.c:1088
enum thread_state state
Definition gdbthread.h:339
ptid_t ptid
Definition gdbthread.h:259
struct thread_fsm * thread_fsm() const
Definition gdbthread.h:452
struct inferior * inf
Definition gdbthread.h:301
thread_control_state control
Definition gdbthread.h:343
void field_core_addr(const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
Definition ui-out.c:478
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
Definition ui-out.c:511
void field_fmt(const char *fldname, const char *format,...) ATTRIBUTE_PRINTF(3
Definition ui-out.c:525
void field_signed(const char *fldname, LONGEST value)
Definition ui-out.c:437
int should_print_stop_to_console(struct interp *console_interp, struct thread_info *tp)
Definition cli-interp.c:89
static bool debug_redirect
Definition cli-logging.c:67
static bool logging_redirect
Definition cli-logging.c:66
int(* deprecated_query_hook)(const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1
Definition top.c:220
@ USER_SELECTED_THREAD
Definition defs.h:598
@ USER_SELECTED_FRAME
Definition defs.h:601
@ USER_SELECTED_INFERIOR
Definition defs.h:595
void(* deprecated_show_load_progress)(const char *section, unsigned long section_sent, unsigned long section_size, unsigned long total_sent, unsigned long total_size)
Definition symfile.c:74
void gdb_setup_readline(int editing)
Definition event-top.c:1278
void gdb_disable_readline(void)
Definition event-top.c:1319
void gdb_readline_no_editing_callback(gdb_client_data client_data)
Definition event-top.c:800
void exception_print(struct ui_file *file, const struct gdb_exception &e)
Definition exceptions.c:106
bool has_stack_frames()
Definition frame.c:1859
frame_info_ptr get_selected_frame(const char *message)
Definition frame.c:1888
@ SRC_AND_LOC
Definition frame.h:811
void print_stack_frame_to_uiout(struct ui_out *uiout, frame_info_ptr, int print_level, enum print_what print_what, int set_current_sal)
Definition stack.c:337
static void ATTRIBUTE_PRINTF(1, 0)
Definition gdb_bfd.c:1154
int gdbarch_has_global_solist(struct gdbarch *gdbarch)
Definition gdbarch.c:4854
void print_selected_thread_frame(struct ui_out *uiout, user_selected_what selection)
Definition thread.c:2009
all_non_exited_threads_range all_non_exited_threads(process_stratum_target *proc_target=nullptr, ptid_t filter_ptid=minus_one_ptid)
Definition gdbthread.h:753
@ THREAD_RUNNING
Definition gdbthread.h:75
struct thread_info * inferior_thread(void)
Definition thread.c:85
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
Definition gnu-nat.c:1790
ptid_t inferior_ptid
Definition infcmd.c:74
void print_selected_inferior(struct ui_out *uiout)
Definition inferior.c:508
struct inferior * current_inferior(void)
Definition inferior.c:55
all_inferiors_range all_inferiors(process_stratum_target *proc_target=nullptr)
Definition inferior.h:821
all_non_exited_inferiors_range all_non_exited_inferiors(process_stratum_target *proc_target=nullptr)
Definition inferior.h:830
void print_no_history_reason(struct ui_out *uiout)
Definition infrun.c:8720
void print_stop_event(struct ui_out *uiout, bool displays)
Definition infrun.c:8791
void print_signal_exited_reason(struct ui_out *uiout, enum gdb_signal siggnal)
Definition infrun.c:8620
bool non_stop
Definition infrun.c:226
void print_exited_reason(struct ui_out *uiout, int exitstatus)
Definition infrun.c:8641
void print_signal_received_reason(struct ui_out *uiout, enum gdb_signal siggnal)
Definition infrun.c:8668
struct interp * interp_lookup(struct ui *ui, const char *name)
Definition interps.c:167
struct interp * top_level_interpreter(void)
Definition interps.c:345
void interp_exec(struct interp *interp, const char *command_str)
Definition interps.c:259
void interp_factory_register(const char *name, interp_factory_func func)
Definition interps.c:78
#define INTERP_MI2
Definition interps.h:368
#define INTERP_MI4
Definition interps.h:370
#define INTERP_MI
Definition interps.h:371
#define INTERP_CONSOLE
Definition interps.h:367
#define INTERP_MI3
Definition interps.h:369
struct ui_file * gdb_stdtarg
Definition main.c:80
struct ui_file * gdb_stdtargerr
Definition main.c:81
mi_cmd_argv_ftype mi_cmd_interpreter_exec
void mi_execute_command(const char *cmd, int from_tty)
Definition mi-main.c:1920
const char * async_reason_lookup(enum async_reply_reason reason)
Definition mi-common.c:50
async_reply_reason
Definition mi-common.h:26
static struct interp * mi_interp_factory(const char *name)
Definition mi-interp.c:928
static void mi_print_breakpoint_for_event(struct mi_interp *mi, breakpoint *bp)
Definition mi-interp.c:552
static void mi_execute_command_input_handler(gdb::unique_xmalloc_ptr< char > &&cmd)
Definition mi-interp.c:237
void mi_output_solib_attribs(ui_out *uiout, struct so_list *solib)
Definition mi-interp.c:727
static int mi_interp_query_hook(const char *ctlstr, va_list ap) ATTRIBUTE_PRINTF(1
Definition mi-interp.c:212
static void mi_on_resume_1(struct mi_interp *mi, process_stratum_target *targ, ptid_t ptid)
Definition mi-interp.c:664
static void mi_remove_notify_hooks(void)
Definition mi-interp.c:206
static int static void mi_insert_notify_hooks(void)
Definition mi-interp.c:200
static void mi_execute_command_wrapper(const char *cmd)
Definition mi-interp.c:218
void _initialize_mi_interp()
Definition mi-interp.c:935
static bool multiple_inferiors_p()
Definition mi-interp.c:650
static void mi_output_running(struct thread_info *thread)
Definition mi-interp.c:630
static void display_mi_prompt(struct mi_interp *mi)
Definition mi-interp.c:66
void mi_output_solib_attribs(ui_out *uiout, struct so_list *solib)
Definition mi-interp.c:727
static struct mi_interp * as_mi_interp(struct interp *interp)
Definition mi-interp.h:117
void mi_load_progress(const char *section_name, unsigned long sent_so_far, unsigned long total_section, unsigned long total_sent, unsigned long grand_total)
Definition mi-main.c:2193
void mi_print_timing_maybe(struct ui_file *file)
Definition mi-main.c:2282
int mi_async_p(void)
Definition mi-main.c:129
void mi_out_rewind(ui_out *uiout)
Definition mi-out.c:370
void mi_out_put(ui_out *uiout, struct ui_file *stream)
Definition mi-out.c:364
std::unique_ptr< mi_ui_out > mi_out_new(const char *mi_version)
Definition mi-out.c:340
struct obj_section * find_pc_section(CORE_ADDR pc)
Definition objfiles.c:1128
static void print_frame(const frame_print_options &opts, frame_info_ptr frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal)
Definition gnu-nat.c:153
pid_t pid
Definition gnu-nat.c:165
struct objfile * objfile
Definition objfiles.h:401
struct bfd_section * the_bfd_section
Definition objfiles.h:398
char so_name[SO_NAME_MAX_PATH_SIZE]
Definition solist.h:56
CORE_ADDR addr_high
Definition solist.h:80
char so_original_name[SO_NAME_MAX_PATH_SIZE]
Definition solist.h:53
char symbols_loaded
Definition solist.h:65
CORE_ADDR addr_low
Definition solist.h:80
bool finished_p() const
Definition thread-fsm.h:87
enum async_reply_reason async_reply_reason()
Definition thread-fsm.h:68
Definition ui.h:55
void(* input_handler)(gdb::unique_xmalloc_ptr< char > &&)
Definition ui.h:82
enum prompt_state prompt_state
Definition ui.h:136
FILE * stdin_stream
Definition ui.h:113
void(* call_readline)(gdb_client_data)
Definition ui.h:78
FILE * instream
Definition ui.h:119
Definition value.h:130
int target_core_of_thread(ptid_t ptid)
Definition target.c:3949
std::unique_ptr< ui_file > ui_file_up
Definition ui-file.h:150
#define current_uiout
Definition ui-out.h:40
struct ui * current_ui
Definition ui.c:35
@ PROMPT_BLOCKED
Definition ui.h:35
@ PROMPTED
Definition ui.h:42
@ PROMPT_NEEDED
Definition ui.h:39
#define SWITCH_THRU_ALL_UIS()
Definition ui.h:215
bool sevenbit_strings
Definition utils.c:108
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1886
void gdb_flush(struct ui_file *stream)
Definition utils.c:1498
void gdb_puts(const char *linebuffer, struct ui_file *stream)
Definition utils.c:1809
#define gdb_stderr
Definition utils.h:187
#define gdb_stdlog
Definition utils.h:190
#define gdb_stdout
Definition utils.h:182