Lines Matching +full:default +full:- +full:state
2 * gdb server stub - system specific bits
7 * Copyright (c) 2003-2005 Fabrice Bellard
10 * SPDX-License-Identifier: LGPL-2.0-or-later
15 #include "qemu/error-report.h"
21 #include "exec/tb-flush.h"
22 #include "system/accel-ops.h"
31 #include "chardev/char-fe.h"
36 /* System emulation specific state */
53 * Return the GDB index for a given vCPU state.
60 return cpu->cpu_index + 1; in gdb_get_cpu_index()
94 for (i = 0; i < s->process_num; i++) { in gdb_chr_event()
95 s->processes[i].attached = !i; in gdb_chr_event()
98 s->c_cpu = gdb_first_attached_cpu(); in gdb_chr_event()
99 s->g_cpu = s->c_cpu; in gdb_chr_event()
104 default: in gdb_chr_event()
110 * In system-mode we stop the VM and wait to send the syscall packet
114 * state, which can cause packets to be dropped and state transition
123 static void gdb_vm_state_change(void *opaque, bool running, RunState state) in gdb_vm_state_change() argument
131 if (running || gdbserver_state.state == RS_INACTIVE) { in gdb_vm_state_change()
151 switch (state) { in gdb_vm_state_change()
153 if (cpu->watchpoint_hit) { in gdb_vm_state_change()
154 switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) { in gdb_vm_state_change()
161 default: in gdb_vm_state_change()
167 cpu->watchpoint_hit->vaddr); in gdb_vm_state_change()
169 GDB_SIGNAL_TRAP, tid->str, type, in gdb_vm_state_change()
170 cpu->watchpoint_hit->vaddr); in gdb_vm_state_change()
171 cpu->watchpoint_hit = NULL; in gdb_vm_state_change()
207 default: in gdb_vm_state_change()
208 trace_gdbstub_hit_unknown(state); in gdb_vm_state_change()
213 g_string_printf(buf, "T%02xthread:%s;", ret, tid->str); in gdb_vm_state_change()
216 gdb_put_packet(buf->str); in gdb_vm_state_change()
236 gdb_put_packet(hex_buf->str); in gdb_monitor_write()
250 cc->internal = true; in char_gdb_class_init()
251 cc->open = gdb_monitor_open; in char_gdb_class_init()
252 cc->chr_write = gdb_monitor_write; in char_gdb_class_init()
255 #define TYPE_CHARDEV_GDB "chardev-gdb"
288 s->processes = g_renew(GDBProcess, s->processes, ++s->process_num); in find_cpu_clusters()
290 process = &s->processes[s->process_num - 1]; in find_cpu_clusters()
293 * GDB process IDs -1 and 0 are reserved. To avoid subtle errors at in find_cpu_clusters()
297 assert(cluster->cluster_id != UINT32_MAX); in find_cpu_clusters()
298 process->pid = cluster->cluster_id + 1; in find_cpu_clusters()
299 process->attached = false; in find_cpu_clusters()
300 process->target_xml = NULL; in find_cpu_clusters()
313 if (pa->pid < pb->pid) { in pid_order()
314 return -1; in pid_order()
315 } else if (pa->pid > pb->pid) { in pid_order()
355 if (cs->len == 0) { in gdbserver_start()
360 trace_gdbstub_op_start(cs->str); in gdbserver_start()
362 if (g_strcmp0(cs->str, "none") != 0) { in gdbserver_start()
363 if (g_str_has_prefix(cs->str, "tcp:")) { in gdbserver_start()
380 chr = qemu_chr_new_noreplay("gdb", cs->str, true, NULL); in gdbserver_start()
411 gdbserver_state.state = chr ? RS_IDLE : RS_INACTIVE; in gdbserver_start()
468 if (cpu->cc->memory_rw_debug) { in gdb_target_memory_rw_debug()
469 return cpu->cc->memory_rw_debug(cpu, addr, buf, len, is_write); in gdb_target_memory_rw_debug()
482 return ms->smp.max_cpus; in gdb_get_max_cpus()
503 if (!params->len) { in gdb_handle_set_qemu_phy_mem_mode()
508 if (!gdb_get_cmd_param(params, 0)->val_ul) { in gdb_handle_set_qemu_phy_mem_mode()
521 if (!params->len) { in gdb_handle_query_rcmd()
526 len = strlen(gdb_get_cmd_param(params, 0)->data); in gdb_handle_query_rcmd()
532 g_assert(gdbserver_state.mem_buf->len == 0); in gdb_handle_query_rcmd()
534 gdb_hextomem(gdbserver_state.mem_buf, gdb_get_cmd_param(params, 0)->data, len); in gdb_handle_query_rcmd()
537 gdbserver_state.mem_buf->data, in gdb_handle_query_rcmd()
538 gdbserver_state.mem_buf->len); in gdb_handle_query_rcmd()
543 * Execution state helpers
571 if (newstates[cpu->cpu_index] == 's') { in gdb_continue_partial()
582 switch (newstates[cpu->cpu_index]) { in gdb_continue_partial()
587 trace_gdbstub_op_stepping(cpu->cpu_index); in gdb_continue_partial()
593 trace_gdbstub_op_continue_cpu(cpu->cpu_index); in gdb_continue_partial()
597 default: in gdb_continue_partial()
598 res = -1; in gdb_continue_partial()
610 * Signal Handling - in system mode we only need SIGINT and SIGTRAP; other
626 default: in gdb_signal_to_target()
627 return -1; in gdb_signal_to_target()
638 if (ops->supports_guest_debug) { in gdb_supports_guest_debug()
639 return ops->supports_guest_debug(); in gdb_supports_guest_debug()
647 if (ops->insert_breakpoint) { in gdb_breakpoint_insert()
648 return ops->insert_breakpoint(cs, type, addr, len); in gdb_breakpoint_insert()
650 return -ENOSYS; in gdb_breakpoint_insert()
656 if (ops->remove_breakpoint) { in gdb_breakpoint_remove()
657 return ops->remove_breakpoint(cs, type, addr, len); in gdb_breakpoint_remove()
659 return -ENOSYS; in gdb_breakpoint_remove()
665 if (ops->remove_all_breakpoints) { in gdb_breakpoint_remove_all()
666 ops->remove_all_breakpoints(cs); in gdb_breakpoint_remove_all()