Skip to content
Snippets Groups Projects
  1. Nov 08, 2023
  2. Aug 24, 2023
  3. May 18, 2023
  4. Apr 28, 2023
    • Ilya Leoshkevich's avatar
      s390x/gdb: Split s390-virt.xml · 8afc43ea
      Ilya Leoshkevich authored
      
      Both TCG and KVM emulate ckc, cputm, last_break and prefix, and it's
      quite useful to have them during debugging. Right now they are grouped
      together with KVM-only pp, pfault_token, pfault_select and
      pfault_compare in s390-virt.xml, and are not available when debugging
      TCG-emulated code.
      
      Move KVM-only registers into the new s390-virt-kvm.xml file. Advertise
      s390-virt.xml always, and the new s390-virt-kvm.xml only for KVM.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Message-Id: <20230314101813.174874-1-iii@linux.ibm.com>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      8afc43ea
  5. Apr 20, 2023
  6. Mar 06, 2023
  7. Feb 21, 2023
  8. Nov 06, 2022
    • TaiseiIto's avatar
      gdb-xml: Fix size of EFER register on i386 architecture when debugged by GDB · 75ac231c
      TaiseiIto authored
      
      Before this commit, there were contradictory descriptions about size of EFER
      register.
      Line 113 says the size is 8 bytes.
      Line 129 says the size is 4 bytes.
      
      As a result, when GDB is debugging an OS running on QEMU, the GDB cannot
      read 'g' packets correctly. This 'g' packet transmits values of each
      registers of machine emulated by QEMU to GDB. QEMU, the packet sender,
      assign 4 bytes for EFER in 'g' packet based on the line 113.
      GDB, the packet receiver, extract 8 bytes for EFER in 'g' packet based on
      the line 129. Therefore, all registers located behind EFER in 'g' packet
      has been shifted 4 bytes in GDB.
      
      After this commit, GDB can read 'g' packets correctly.
      
      Signed-off-by: default avatarTaiseiIto <taisei1212@outlook.jp>
      Message-Id: <TY0PR0101MB4285F637209075C9F65FCDA6A4479@TY0PR0101MB4285.apcprd01.prod.exchangelabs.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      75ac231c
  9. Sep 26, 2022
    • Andrew Burgess's avatar
      target/riscv: remove fixed numbering from GDB xml feature files · 4c0f0b66
      Andrew Burgess authored
      
      The fixed register numbering in the various GDB feature files for
      RISC-V only exists because these files were originally copied from the
      GDB source tree.
      
      However, the fixed numbering only exists in the GDB source tree so
      that GDB, when it connects to a target that doesn't provide a target
      description, will use a specific numbering scheme.
      
      That numbering scheme is designed to be compatible with the first
      versions of QEMU (for RISC-V), that didn't send a target description,
      and relied on a fixed numbering scheme.
      
      Because of the way that QEMU manages its target descriptions,
      recording the number of registers in each feature, and just relying on
      GDB's numbering starting from 0, then I propose that we remove all the
      fixed numbering from the RISC-V feature xml files, and just rely on
      the standard numbering scheme.  Plenty of other targets manage their
      xml files this way, e.g. ARM, AArch64, Loongarch, m68k, rx, and s390.
      
      Signed-off-by: default avatarAndrew Burgess <aburgess@redhat.com>
      Acked-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Message-Id: <6069395f90e6fc24dac92197be815fedf42f5974.1661934573.git.aburgess@redhat.com>
      Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      4c0f0b66
    • Andrew Burgess's avatar
      target/riscv: remove fflags, frm, and fcsr from riscv-*-fpu.xml · 94452ac4
      Andrew Burgess authored
      
      While testing some changes to GDB's handling for the RISC-V registers
      fcsr, fflags, and frm, I spotted that QEMU includes these registers
      twice in the target description it sends to GDB, once in the fpu
      feature, and once in the csr feature.
      
      Right now things basically work OK, QEMU maps these registers onto two
      different register numbers, e.g. fcsr maps to both 68 and 73, and GDB
      can use either of these to access the register.
      
      However, GDB's target descriptions don't really work this way, each
      register should appear just once in a target description, mapping the
      register name onto the number GDB should use when accessing the
      register on the target.  Duplicate register names actually result in
      duplicate registers on the GDB side, however, as the registers have
      the same name, the user can only access one of these registers.
      
      Currently GDB has a hack in place, specifically for RISC-V, to spot
      the duplicate copies of these three registers, and hide them from the
      user, ensuring the user only ever sees a single copy of each.
      
      In this commit I propose fixing this issue on the QEMU side, and in
      the process, simplify the fpu register handling a little.
      
      I think we should, remove fflags, frm, and fcsr from the two (32-bit
      and 64-bit) fpu feature xml files.  These files will only contain the
      32 core floating point register f0 to f31.  The fflags, frm, and fcsr
      registers will continue to be advertised in the csr feature as they
      currently are.
      
      With that change made, I will simplify riscv_gdb_get_fpu and
      riscv_gdb_set_fpu, removing the extra handling for the 3 status
      registers.
      
      Signed-off-by: default avatarAndrew Burgess <aburgess@redhat.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Message-Id: <0fbf2a5b12e3210ff3867d5cf7022b3f3462c9c8.1661934573.git.aburgess@redhat.com>
      Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      94452ac4
  10. Aug 05, 2022
  11. Jun 06, 2022
  12. Nov 02, 2021
  13. Sep 30, 2021
    • Peter Maydell's avatar
      target/arm: Don't put FPEXC and FPSID in org.gnu.gdb.arm.vfp XML · b355f08a
      Peter Maydell authored
      
      Currently we send VFP XML which includes D0..D15 or D0..D31, plus
      FPSID, FPSCR and FPEXC.  The upstream GDB tolerates this, but its
      definition of this XML feature does not include FPSID or FPEXC.  In
      particular, for M-profile cores there are no FPSID or FPEXC
      registers, so advertising those is wrong.
      
      Move FPSID and FPEXC into their own bit of XML which we only send for
      A and R profile cores.  This brings our definition of the XML
      org.gnu.gdb.arm.vfp feature into line with GDB's own (at least for
      non-Neon cores...) and means we don't claim to have FPSID and FPEXC
      on M-profile.
      
      (It seems unlikely to me that any gdbstub users really care about
      being able to look at FPEXC and FPSID; but we've supplied them to gdb
      for a decade and it's not hard to keep doing so.)
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20210921162901.17508-5-peter.maydell@linaro.org
      b355f08a
  14. Jan 16, 2021
  15. Jul 10, 2020
  16. May 14, 2020
    • Peter Maydell's avatar
      target/arm: Use correct GDB XML for M-profile cores · c888f7e0
      Peter Maydell authored
      GDB's remote protocol requires M-profile cores to use the feature
      name 'org.gnu.gdb.arm.m-profile' instead of the 'org.gnu.gdb.arm.core'
      feature used for A- and R-profile cores. We weren't doing this, which
      meant GDB treated our M-profile cores like A-profile ones. This mostly
      doesn't matter, but for instance means that it doesn't correctly
      handle backtraces where an M-profile exception frame is involved.
      
      Ship a copy of GDB's arm-m-profile.xml and use it on the M-profile
      cores.  The integer registers have the same offsets as the
      arm-core.xml, but register 25 is the M-profile XPSR rather than the
      A-profile CPSR, so we need to update arm_cpu_gdb_read_register() and
      arm_cpu_gdb_write_register() to handle XSPR reads and writes.
      
      Fixes: https://bugs.launchpad.net/qemu/+bug/1877136
      
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20200507134755.13997-1-peter.maydell@linaro.org
      c888f7e0
  17. May 06, 2020
    • KONRAD Frederic's avatar
      target/m68k: fix gdb for m68xxx · a976ed3f
      KONRAD Frederic authored
      
      Currently "cf-core.xml" is sent to GDB when using any m68k flavor.  Thing is
      it uses the "org.gnu.gdb.coldfire.core" feature name and gdb 8.3 then expects
      a coldfire FPU instead of the default m68881 FPU.
      
      This is not OK because the m68881 floats registers are 96 bits wide so it
      crashes GDB with the following error message:
      
      (gdb) target remote localhost:7960
      Remote debugging using localhost:7960
      warning: Register "fp0" has an unsupported size (96 bits)
      warning: Register "fp1" has an unsupported size (96 bits)
      ...
      Remote 'g' packet reply is too long (expected 148 bytes, got 180 bytes):    \
        00000000000[...]0000
      
      With this patch: qemu-system-m68k -M none -cpu m68020 -s -S
      
      (gdb) tar rem :1234
      Remote debugging using :1234
      warning: No executable has been specified and target does not support
      determining executable automatically.  Try using the "file" command.
      0x00000000 in ?? ()
      (gdb) p $fp0
      $1 = nan(0xffffffffffffffff)
      
      Signed-off-by: default avatarKONRAD Frederic <frederic.konrad@adacore.com>
      Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
      Message-Id: <1588094279-17913-3-git-send-email-frederic.konrad@adacore.com>
      Message-Id: <20200430190122.4592-10-alex.bennee@linaro.org>
      a976ed3f
  18. Mar 19, 2020
  19. Oct 28, 2019
  20. Mar 19, 2019
  21. Feb 05, 2019
    • Doug Gale's avatar
      gdbstub: Fix i386/x86_64 machine description and add control registers · 7b0f97ba
      Doug Gale authored
      
      The machine description we send is being (silently) thrown on the floor
      by GDB and GDB silently uses the default machine description, because
      the xml parse fails on <feature> nested within <feature>.
      Changes to the xml in qemu source code have no effect.
      
      In addition, the default machine description has fs_base, which fails to
      be retrieved, which breaks the whole register window.  Add it and the
      other control registers.
      
      Signed-off-by: default avatarDoug Gale <doug16k@gmail.com>
      Message-Id: <20190124040457.2546-1-doug16k@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7b0f97ba
  22. Jul 14, 2017
  23. Jun 21, 2017
  24. Jun 07, 2017
    • Abdallah Bouassida's avatar
      target/i386: Add GDB XML description for SSE registers · b8158192
      Abdallah Bouassida authored
      
      Add an XML description for SSE registers (XMM+MXCSR) for both X86
      and X86-64 architectures in the GDB stub:
      - configure: Define gdb_xml_files for the X86 targets (32 and 64bit).
      - gdb-xml/i386-32bit-sse.xml & gdb-xml/i386-64bit-sse.xml: The XML files
      that contain a description of the XMM + MXCSR registers.
      - gdb-xml/i386-32bit.xml & gdb-xml/i386-64bit.xml: wrappers that include
      the XML file of the core registers and the other XML file of the SSE registers.
      - target/i386/cpu.c: Modify the gdb_core_xml_file to the new XML wrapper,
        modify the gdb_num_core_regs to fit the registers number defined in each
        XML file.
      
      Signed-off-by: default avatarAbdallah Bouassida <abdallah.bouassida@lauterbach.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b8158192
  25. May 05, 2017
    • Abdallah Bouassida's avatar
      target/i386: Add GDB XML register description support · 00fcd100
      Abdallah Bouassida authored
      
      This patch implements XML target description support for X86 and X86-64
      architectures in the GDB stub, as the way with ARM and PowerPC:
      - gdb-xml/32bit-core.xml & gdb-xml/64bit-core.xml: Adding the XML target
        description files, these files are picked from GDB source code.
      - configure: Define gdb_xml_files for X86 targets.
      - target/i386/cpu.c: Define gdb_core_xml_file and gdb_arch_name to add
        XML awareness for this architecture, modify the gdb_num_core_regs to
        fit the registers number defined in each XML file.
      
      Signed-off-by: default avatarAbdallah Bouassida <abdallah.bouassida@lauterbach.com>
      Message-Id: <2b3c8119-1602-28c7-eab4-296593877103@lauterbach.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      00fcd100
  26. Jan 30, 2016
  27. Oct 02, 2015
  28. Sep 07, 2015
  29. May 27, 2015
  30. Sep 01, 2014
  31. Dec 17, 2013
  32. Sep 10, 2013
  33. Jul 12, 2009
    • Nathan Froyd's avatar
      gdb-xml: fix hacks in powerpc register numbering · 22555301
      Nathan Froyd authored
      
      The powerpc xml files contained a hack--an empty, non-existent
      register--for getting the register numbers to line up for
      newer (XML-aware) and older (non-XML-aware) GDB.  While this hack worked
      in some cases, it didn't work in all cases, notably when the user used
      `finish' or `continue': GDB would attempt to read the non-existent
      register and QEMU would complain.
      
      This patch fixes things up properly.  Instead of inserting a fake
      register, we explicitly declare the floating-point and SPE registers to
      start at 71.  This action accomplishes the same thing as the nasty hack,
      except that now GDB never tries to fetch the non-existant register 70.
      
      Signed-off-by: default avatarNathan Froyd <froydnj@codesourcery.com>
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      22555301
  34. Mar 07, 2009
    • Aurelien Jarno's avatar
      Work around QEMU GDB stub suboptimality · d2c75345
      Aurelien Jarno authored
      
      The current XML files claim, on floating point-supporting Power chips,
      that $f0 is register 70.  This would be fine, except that register 70
      for non-XML-aware GDB is FPSCR.  More importantly, 70 is less than
      NUM_CORE_REGS (71) for Power, so a request for register 70 goes to the
      "core" register reading routines, rather than the floating-point
      register read routine we registered with gdb_register_coprocessor.
      
      Therefore, when we are talking to an XML-aware GDB, we claim that
      register has zero width, which causes the rest of QEMU's GDB stub to
      send an error back to GDB, which causes GDB to be unable to read the
      floating-point registers.  (The problem is also present for SPE
      registers and occurs in a slightly different way for Altivec registers.)
      
      The best way to fix this is to have the "core register" XML files for
      PPC32 and PPC64 claim that there is a 4-byte register 70, which causes
      $f0 to be register 71, and everything works just fine from that point
      forward.
      
      Signed-off-by: default avatarNathan Froyd <froydnj@codesourcery.com>
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      
      git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6770 c046a42c-6fe2-441c-8c8c-71466251a162
      d2c75345
Loading