summaryrefslogtreecommitdiff
path: root/gdbstub.c
AgeCommit message (Collapse)AuthorFilesLines
2013-07-23gdbstub: Change gdb_register_coprocessor() argument to CPUStateAndreas Färber1-4/+3
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Move gdb_regs field from CPU_COMMON to CPUStateAndreas Färber1-5/+6
Prepares for changing gdb_register_coprocessor() argument to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change GDBState::{c,g}_cpu and find_cpu() to CPUStateAndreas Färber1-52/+52
Use CPUState::env_ptr where still needed. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Introduce CPUClass::memory_rw_debug() for target_memory_rw_debug()Andreas Färber1-9/+12
Make inline target_memory_rw_debug() always available and change its argument to CPUState. Let it check if CPUClass::memory_rw_debug provides a specialized callback and fall back to cpu_memory_rw_debug() otherwise. The only overriding implementation is for 32-bit sparc. This prepares for changing GDBState::g_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23exec: Change cpu_memory_rw_debug() argument to CPUStateAndreas Färber1-1/+1
Propagate X86CPU in kvmvapic for simplicity. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change gdb_{read,write}_register() argument to CPUStateAndreas Färber1-6/+10
Use CPUState::env_ptr for now. Prepares for changing GDBState::g_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change gdb_handlesig() argument to CPUStateAndreas Färber1-3/+3
Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change syscall callback argument to CPUStateAndreas Färber1-1/+1
Callback implementations were specific to arm and m68k, so can easily cast to ARMCPU and M68kCPU respectively. Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUStateAndreas Färber1-4/+8
CPUArchState is no longer directly used since converting CPU loops to CPUState. Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Change cpu_single_step() argument to CPUStateAndreas Färber1-4/+5
Use CPUState::env_ptr for now. Needed for GdbState::c_cpu. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Update gdb_handlesig() and gdb_signalled() Coding StyleAndreas Färber1-47/+47
In particular reindent to 4 instead of 2 spaces. Prepares for changing cpu_single_step() argument in gdb_handlesig(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()Andreas Färber1-33/+6
This moves setting the Program Counter from gdbstub into target code. Use vaddr type as upper-bound replacement for target_ulong. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23gdbstub: Change GDBState::query_cpu to CPUStateAndreas Färber1-5/+4
Since first_cpu/next_cpu are CPUState, CPUArchState is no longer needed. This resolves a NULL pointer dereference of query_cpu, introduced with commit 182735efaf956ccab50b6d74a4fed163e0f35660 and reported by TeLeMan and Max Filippov. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09cpu: Make first_cpu and next_cpu CPUStateAndreas Färber1-16/+23
Move next_cpu from CPU_COMMON to CPUState. Move first_cpu variable to qom/cpu.h. gdbstub needs to use CPUState::env_ptr for now. cpu_copy() no longer needs to save and restore cpu_next. Acked-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Rebased, simplified cpu_copy()] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09kvm: Change kvm_remove_all_breakpoints() argument to CPUStateAndreas Färber1-1/+1
Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09Revert "gdbstub: Simplify find_cpu()"Andreas Färber1-4/+8
This reverts commit c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3, which replaced cpu_index() with cpu_index field, leading to deviation from thread ID for NTPL and off-by-one otherwise. Reported-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28gdbstub: Set gdb_set_stop_cpu() argument to CPUStateAndreas Färber1-1/+3
Use CPUState::env_ptr for now. Prepares for changing cpu_handle_guest_debug() argument to CPUState. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28cpu: Change cpu_exit() argument to CPUStateAndreas Färber1-1/+1
It no longer depends on CPUArchState, so move it to qom/cpu.c. Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28kvm: Change cpu_synchronize_state() argument to CPUStateAndreas Färber1-4/+4
Change Monitor::mon_cpu to CPUState as well. Reviewed-by: liguang <lig.fnst@cn.fujitsu.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28gdbstub: Simplify find_cpu()Andreas Färber1-8/+4
Use qemu_get_cpu() and CPUState::env_ptr. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-10gdbstub: let the debugger resume from guest panicked statePaolo Bonzini1-0/+3
While in general we forbid a "continue" from the guest panicked state, it makes sense to have an exception for that when continuing in the debugger. Perhaps the guest entered that state due to a bug, for example, and we want to continue no matter what. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Message-id: 1370272015-9659-3-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10gdbstub: fix for commit 87f25c12bfeaaa0c41fb857713bbc7e8a9b757dcPaolo Bonzini1-1/+1
This commit used the wrong check to prevent an assertion failure. After this commit, you need to start a guest in the monitor, you cannot use anymore the "c" command in the debugger. This is undesirable. The commit's aim was to prevent a restart after a KVM internal error or something like that; use runstate_needs_reset() for that. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Message-id: 1370272015-9659-2-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-30gdbstub: do not restart crashed guestPaolo Bonzini1-1/+3
If a guest has crashed with an internal error or similar, detaching gdb (or any other debugger action) should not restart it. Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1369912840-18577-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-08hw: move headers to include/Paolo Bonzini1-1/+1
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-04qemu-char: Call fe_claim / fe_release when not using qdev chr propertiesHans de Goede1-0/+1
chardev-frontends need to explictly check, increase and decrement the avail_connections "property" of the chardev when they are not using a qdev-chardev-property for the chardev. This fixes things like: qemu-kvm -chardev stdio,id=foo -device isa-serial,chardev=foo \ -mon chardev=foo Working, where they should fail. Most of the changes here are due to old hardware emulation code which is using serial_hds directly rather then a qdev-chardev-property. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364412581-3672-3-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-22Merge branch 'ppc-for-upstream' of git://github.com/agraf/qemuAurelien Jarno1-1/+2
* 'ppc-for-upstream' of git://github.com/agraf/qemu: (58 commits) target-ppc: Use NARROW_MODE macro for tlbie target-ppc: Use NARROW_MODE macro for addresses target-ppc: Use NARROW_MODE macro for comparisons target-ppc: Use NARROW_MODE macro for branches target-ppc: Fix add and subf carry generation in narrow mode target-ppc: Use QOM method dispatch for MMU fault handling target-ppc: Move ppc tlb_fill implementation into mmu_helper.c target-ppc: Split user only code out of mmu_helper.c mmu-hash64: Implement Virtual Page Class Key Protection mmu-hash*: Merge translate and fault handling functions mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug() mmu-hash*: Correctly mask RPN from hash PTE mmu-hash*: Clean up real address calculation mmu-hash*: Clean up PTE flags update mmu-hash64: Factor SLB N bit into permissions bits mmu-hash*: Clean up permission checking mmu-hash32: Remove nx from context structure mmu-hash*: Don't update PTE flags when permission is denied mmu-hash32: Don't look up page tables on BAT permission error mmu-hash32: Cleanup BAT lookup ...
2013-03-22PPC/GDB: handle read and write of fpscrFabien Chouteau1-1/+2
Although the support of this register may be uncomplete, there are no reason to prevent the debugger from reading or writing it. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-03-22MinGW: Replace setsockopt by qemu_setsocketoptStefan Weil1-1/+1
Instead of adding missing type casts which are needed by MinGW for the 4th argument, the patch uses qemu_setsockopt which was invented for this purpose. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-12cpu: Move halted and interrupt_request fields to CPUStateAndreas Färber1-1/+1
Both fields are used in VMState, thus need to be moved together. Explicitly zero them on reset since they were located before breakpoints. Pass PowerPCCPU to kvmppc_handle_halt(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-03-04move socket_set_nodelay to osdep.cMORITA Kazutaka1-3/+2
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-02-16cpu: Move host_tid field to CPUStateAndreas Färber1-5/+9
Change gdbstub's cpu_index() argument to CPUState now that CPUArchState is no longer used. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-01-15cpu: Move cpu_index field to CPUStateAndreas Färber1-1/+2
Note that target-alpha accesses this field from TCG, now using a negative offset. Therefore the field is placed last in CPUState. Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change. Move common parts of mips cpu_state_reset() to mips_cpu_reset(). Acked-by: Richard Henderson <rth@twiddle.net> (for alpha) [AF: Rebased onto ppc CPU subclasses and openpic changes] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-01-05target-s390: Fix gdbstubRichard Henderson1-30/+48
The real gdb protocol doesn't split out pc or cc as real registers. Those are pseudos that are extracted as needed from the PSW. Don't modify env->cc_op during read -- that way lies heisenbugs. Fill in the XXX for the fp registers. Remove duplicated defines in cpu.h. Signed-off-by: Richard Henderson <rth@twiddle.net>
2012-12-19softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19exec: move include files to include/exec/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-09-22target-xtensa: add FP registersMax Filippov1-0/+8
There are 16 32-bit FP registers (f0 - f15), control and status user registers (fcr, fsr). See ISA, 4.3.10 for more details. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-09-21gdbstub/sh4: fix build with USE_SOFTFLOAT_STRUCT_TYPESAurelien Jarno1-54/+90
We have to use different type to access float values when USE_SOFTFLOAT_STRUCT_TYPES is defined. Rework SH4 version of cpu_gdb_{read,write}_register() using a single case, and fixing the coding style. Use ldll_p() and stfl_p() to access float values. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-07-27target-or32: Add gdb stub supportJia Liu1-0/+64
Add OpenRISC gdb stub support. Signed-off-by: Jia Liu <proljc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04make gdb_id() generally avialable and rename it to cpu_index()Wen Congyang1-14/+5
The following patch also needs this API, so make it generally avialable. The function gdb_id() will not be used in gdbstub.c now, so its name is not suitable, and rename it to cpu_index() Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-21gdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pcPeter Maydell1-2/+1
Synchronize the CPU state via cpu_sychronize_state() unconditionally in gdb_set_cpu_pc() rather than only in some of the target ifdef ladder cases. We can divide the CPUs into three categories: * non-KVM targets: no change of behaviour since we will use the kvm-stub.c no-op function. * i386 and s390: no change of behaviour since they were already calling this function * PPC (in KVM mode): this fixes an error: failing to synchronise was accidental and probably a bug. This also paves the way for other targets (specifically ARM) which can add KVM support in future without having to add another target specific change to this bit of code. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-24gdbserver: Don't send a GDB syscall until the system CPU is stoppedMeador Inge1-15/+27
Fix an issue where the GDB server implementation was sending GDB syscall requests while the system CPU was still running. Syscall requests must be sent while the CPU is stopped otherwise replies from the GDB client might get dropped and the GDB server might be incorrectly transitioned into a 'RUN_STATE_PAUSED' state. Signed-off-by: Meador Inge <meadori@codesourcery.com> [PMM: trivial rebase, reinstated comma after last item in RSState enum] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-14Rename CPUState -> CPUArchStateAndreas Färber1-22/+22
Scripted conversion: for file in *.[hc] hw/*.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done All occurrences of CPUArchState are expected to be replaced by QOM CPUState, once all targets are QOM'ified and common fields have been extracted. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-14monitor: Avoid CPUState in read/write functionsAndreas Färber1-28/+28
Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-11gdbstub: Do not kill target in system emulation modeJan Kiszka1-0/+2
Too many VM kittens were killed since 7d03f82f81. Another one just died under my fat fingers. When you quit a kgdb session, does the Linux kernel power off? Or when you terminate gdb attached to a hardware debugger, does your board vanish in space? No. So let's stop terminating QEMU when the gdbstub receives a kill commando in system emulation mode. Real termination can still be achieved via "monitor quit". We keep the behavior for user mode emulation which is arguably more like a gdbserver scenario. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-06gdbstub: Fix fd leak in gdbserver_open() error pathPeter Maydell1-0/+2
Fix a leak of a file descriptor in error exit paths in gdbserver_open(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14Fix spelling in comments, documentation and messagesStefan Weil1-1/+1
accidently->accidentally annother->another choosen->chosen consideres->considers decriptor->descriptor developement->development paramter->parameter preceed->precede preceeding->preceding priviledge->privilege propogation->propagation substraction->subtraction throught->through upto->up to usefull->useful Fix also grammar in posix-aio-compat.c Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>