[0/5] Set osabi in remote target descriptions

Message ID cover.1728407374.git.aburgess@redhat.com
Headers
Series Set osabi in remote target descriptions |

Message

Andrew Burgess Oct. 8, 2024, 5:11 p.m. UTC
  I tried doing some remote debugging of a Window machine from a Linux
machine and ran into some problems caused by gdbserver failing to set
the osabi in the target description that is sent to GDB.  This series
fixes this issue.

In v2:

  - Patches 3 & 4 are new.  These are refactoring to allow for the
    updated patch 5.

  - Patch 5 is mostly the same, except the osabi is now set based on
    the enum values, rather than the osabi name strings.

Thanks,
Andrew

---

Andrew Burgess (5):
  gdbserver: make arch and osabi names gdb::unique_xmalloc_ptr<char>
  gdb: make use of set_tdesc_osabi overload in features/ files
  gdb: split osabi support between gdb/ and gdbsupport/ directories
  gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi
  gdbserver: pass osabi to GDB in target description

 gdb/arch/amd64.c                     |   3 +-
 gdb/arch/i386.c                      |   3 +-
 gdb/arch/tic6x.c                     |   3 +-
 gdb/features/mips-dsp-linux.c        |   2 +-
 gdb/features/mips-linux.c            |   2 +-
 gdb/features/or1k-linux.c            |   2 +-
 gdb/features/sparc/sparc32-solaris.c |   2 +-
 gdb/features/sparc/sparc64-solaris.c |   2 +-
 gdb/osabi.c                          | 120 +++++++--------------------
 gdb/osabi.h                          |  45 ++--------
 gdb/target-descriptions.c            |  11 +--
 gdb/target-descriptions.h            |   1 -
 gdbserver/linux-aarch32-tdesc.cc     |   2 +-
 gdbserver/linux-aarch64-tdesc.cc     |   3 +-
 gdbserver/linux-arc-low.cc           |   2 +-
 gdbserver/linux-arm-tdesc.cc         |   2 +-
 gdbserver/linux-csky-low.cc          |   2 +-
 gdbserver/linux-loongarch-low.cc     |   2 +-
 gdbserver/linux-riscv-low.cc         |   2 +-
 gdbserver/linux-tic6x-low.cc         |   2 +-
 gdbserver/linux-x86-tdesc.cc         |  15 +++-
 gdbserver/netbsd-aarch64-low.cc      |   2 +-
 gdbserver/netbsd-amd64-low.cc        |   2 +-
 gdbserver/netbsd-i386-low.cc         |   2 +-
 gdbserver/tdesc.cc                   |  24 +++---
 gdbserver/tdesc.h                    |  11 ++-
 gdbserver/win32-i386-low.cc          |   4 +-
 gdbserver/win32-low.h                |   7 ++
 gdbsupport/Makefile.am               |   1 +
 gdbsupport/Makefile.in               |  15 ++--
 gdbsupport/osabi-common.cc           |  98 ++++++++++++++++++++++
 gdbsupport/osabi-common.def          |  57 +++++++++++++
 gdbsupport/osabi-common.h            |  54 ++++++++++++
 gdbsupport/tdesc.h                   |   4 +-
 34 files changed, 319 insertions(+), 190 deletions(-)
 create mode 100644 gdbsupport/osabi-common.cc
 create mode 100644 gdbsupport/osabi-common.def
 create mode 100644 gdbsupport/osabi-common.h


base-commit: bcb92f7ba7b22ac882c000cabfd7ca8bea47c184
  

Comments

Simon Marchi Oct. 10, 2024, 3:57 p.m. UTC | #1
On 2024-10-08 13:11, Andrew Burgess wrote:
> I tried doing some remote debugging of a Window machine from a Linux
> machine and ran into some problems caused by gdbserver failing to set
> the osabi in the target description that is sent to GDB.  This series
> fixes this issue.
> 
> In v2:
> 
>   - Patches 3 & 4 are new.  These are refactoring to allow for the
>     updated patch 5.
> 
>   - Patch 5 is mostly the same, except the osabi is now set based on
>     the enum values, rather than the osabi name strings.
> 
> Thanks,
> Andrew

I'm done sending comments, nothing is a blocker, so feel free to address
them or not, then:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  
Andrew Burgess Oct. 10, 2024, 4:41 p.m. UTC | #2
Simon Marchi <simark@simark.ca> writes:

> On 2024-10-08 13:11, Andrew Burgess wrote:
>> I tried doing some remote debugging of a Window machine from a Linux
>> machine and ran into some problems caused by gdbserver failing to set
>> the osabi in the target description that is sent to GDB.  This series
>> fixes this issue.
>> 
>> In v2:
>> 
>>   - Patches 3 & 4 are new.  These are refactoring to allow for the
>>     updated patch 5.
>> 
>>   - Patch 5 is mostly the same, except the osabi is now set based on
>>     the enum values, rather than the osabi name strings.
>> 
>> Thanks,
>> Andrew
>
> I'm done sending comments, nothing is a blocker, so feel free to address
> them or not, then:
>
> Approved-By: Simon Marchi <simon.marchi@efficios.com>

I've addressed all the minor issues you raised and pushed this series.

I've not addressed the osabi being set to GNU/Linux in
amd64_create_target_description, which I agree is a little weird.

I still have an item on my todo list to refactor the x86 target
description creation code, so I've added a note to look at this when I
get to that task (if it's not been addressed earlier), though it'll be
towards the end of this quarter, or Q1 2025 before I'll have time to
look at the target description stuff again I think.

Thanks,
Andrew