public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GDB / AArch64 / MacOS
@ 2023-07-19 13:19 Andrew Haley
  2023-07-19 17:02 ` John Baldwin
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Haley @ 2023-07-19 13:19 UTC (permalink / raw)
  To: gdb

What is the status of this combo? It seems that GDB works fine for a compiled
(emulated in Rosetta) MacOS/x86 app, but not a MacOS/AArch64 app. Has anyone
seen patches to make this work?

Thanks,

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 13:19 GDB / AArch64 / MacOS Andrew Haley
@ 2023-07-19 17:02 ` John Baldwin
  2023-07-19 17:05   ` Paul Koning
  0 siblings, 1 reply; 7+ messages in thread
From: John Baldwin @ 2023-07-19 17:02 UTC (permalink / raw)
  To: Andrew Haley, gdb

On 7/19/23 6:19 AM, Andrew Haley via Gdb wrote:
> What is the status of this combo? It seems that GDB works fine for a compiled
> (emulated in Rosetta) MacOS/x86 app, but not a MacOS/AArch64 app. Has anyone
> seen patches to make this work?

I don't think there is any support for MacOS/AArch64 as a target (e.g. no
aarch64-darwin-nat.c) and I haven't seen any patches for that either.

-- 
John Baldwin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 17:02 ` John Baldwin
@ 2023-07-19 17:05   ` Paul Koning
  2023-07-19 19:02     ` Andrew Haley
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Koning @ 2023-07-19 17:05 UTC (permalink / raw)
  To: John Baldwin; +Cc: Andrew Haley, gdb



> On Jul 19, 2023, at 1:02 PM, John Baldwin <jhb@FreeBSD.org> wrote:
> 
> On 7/19/23 6:19 AM, Andrew Haley via Gdb wrote:
>> What is the status of this combo? It seems that GDB works fine for a compiled
>> (emulated in Rosetta) MacOS/x86 app, but not a MacOS/AArch64 app. Has anyone
>> seen patches to make this work?
> 
> I don't think there is any support for MacOS/AArch64 as a target (e.g. no
> aarch64-darwin-nat.c) and I haven't seen any patches for that either.

I sure would like one, though.  Using LLDB is such a pain...

	paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 17:05   ` Paul Koning
@ 2023-07-19 19:02     ` Andrew Haley
  2023-07-19 19:29       ` John Baldwin
  2023-07-23 19:51       ` Tom Tromey
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Haley @ 2023-07-19 19:02 UTC (permalink / raw)
  To: Paul Koning, John Baldwin; +Cc: gdb

On 7/19/23 18:05, Paul Koning wrote:
> 
>> On Jul 19, 2023, at 1:02 PM, John Baldwin <jhb@FreeBSD.org> wrote:
>>
>> On 7/19/23 6:19 AM, Andrew Haley via Gdb wrote:
>>> What is the status of this combo? It seems that GDB works fine for a compiled
>>> (emulated in Rosetta) MacOS/x86 app, but not a MacOS/AArch64 app. Has anyone
>>> seen patches to make this work?
>>
>> I don't think there is any support for MacOS/AArch64 as a target (e.g. no
>> aarch64-darwin-nat.c) and I haven't seen any patches for that either.

Maybe I could start with the AArch64/BSD target, do you think? The
differences would be the way that args are passed between functions
and stack layouts, I guess.

> I sure would like one, though.  Using LLDB is such a pain...

It surely is. I'll have a look at what's involved. Trouble is, how will I
debug it? I guess I'll have to use LLDB. Ewww.... ;-)

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 19:02     ` Andrew Haley
@ 2023-07-19 19:29       ` John Baldwin
  2023-07-20  8:50         ` Andrew Haley
  2023-07-23 19:51       ` Tom Tromey
  1 sibling, 1 reply; 7+ messages in thread
From: John Baldwin @ 2023-07-19 19:29 UTC (permalink / raw)
  To: Andrew Haley, Paul Koning; +Cc: gdb

On 7/19/23 12:02 PM, Andrew Haley wrote:
> On 7/19/23 18:05, Paul Koning wrote:
>>
>>> On Jul 19, 2023, at 1:02 PM, John Baldwin <jhb@FreeBSD.org> wrote:
>>>
>>> On 7/19/23 6:19 AM, Andrew Haley via Gdb wrote:
>>>> What is the status of this combo? It seems that GDB works fine for a compiled
>>>> (emulated in Rosetta) MacOS/x86 app, but not a MacOS/AArch64 app. Has anyone
>>>> seen patches to make this work?
>>>
>>> I don't think there is any support for MacOS/AArch64 as a target (e.g. no
>>> aarch64-darwin-nat.c) and I haven't seen any patches for that either.
> 
> Maybe I could start with the AArch64/BSD target, do you think? The
> differences would be the way that args are passed between functions
> and stack layouts, I guess.

I think you are probably better off starting with the x86 darwin target
since it uses Mach ports for debugging rather than ptrace.  Probably the
architecture-specific parts you would need (dealing with different register
sets, etc.) is fairly small.

-- 
John Baldwin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 19:29       ` John Baldwin
@ 2023-07-20  8:50         ` Andrew Haley
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Haley @ 2023-07-20  8:50 UTC (permalink / raw)
  To: John Baldwin, Paul Koning; +Cc: gdb

On 7/19/23 20:29, John Baldwin wrote:
> I think you are probably better off starting with the x86 darwin target
> since it uses Mach ports for debugging rather than ptrace.  Probably the
> architecture-specific parts you would need (dealing with different register
> sets, etc.) is fairly small.

Thanks, good point. The AArch64/MacOS calling convention is a bit of a nightmare, in
that it packs args into registers in a weird way.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GDB / AArch64 / MacOS
  2023-07-19 19:02     ` Andrew Haley
  2023-07-19 19:29       ` John Baldwin
@ 2023-07-23 19:51       ` Tom Tromey
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2023-07-23 19:51 UTC (permalink / raw)
  To: Andrew Haley via Gdb; +Cc: Paul Koning, John Baldwin, Andrew Haley

Andrew> Maybe I could start with the AArch64/BSD target, do you think? The
Andrew> differences would be the way that args are passed between functions
Andrew> and stack layouts, I guess.

There's two parts to a gdb port like this.

One is the "tdep" code.  This holds target- and arch-dependent
information.  This is where you'd put things like knowledge of the ABI.

There's also the "nat" code.  This is host dependent code that knows how
to do low-level debugging.  E.g., linux-nat handles calling ptrace.

The split is done so cross debugging can work -- the tdep code can be
built anywhere and be used for remote debugging.  These days the nat
code tends to be shared somewhat with gdbserver, though I don't think
that was ever ported to Darwin.

For a new Darwin port you will probably need both of these.

Tom

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-23 19:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19 13:19 GDB / AArch64 / MacOS Andrew Haley
2023-07-19 17:02 ` John Baldwin
2023-07-19 17:05   ` Paul Koning
2023-07-19 19:02     ` Andrew Haley
2023-07-19 19:29       ` John Baldwin
2023-07-20  8:50         ` Andrew Haley
2023-07-23 19:51       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).