* [PATCH] Hurd port: update interface to match upstream and fix warnings.
@ 2024-02-07 6:53 Flavio Cruz
2024-02-07 16:47 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Flavio Cruz @ 2024-02-07 6:53 UTC (permalink / raw)
To: bug-hurd, gdb-patches
We have recently updated the interface for raising exceptions to use
long [1] and updated mach_port_t to be "unsigned int". This patches fixes
those problems and will help us port GDB to Hurd x86_64.
Tested on Hurd i686 and x86_64.
[1] https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/include/mach/exc.defs
---
gdb/exc_request.defs | 2 +-
gdb/gnu-nat.c | 37 +++++++++++++++++++------------------
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/gdb/exc_request.defs b/gdb/exc_request.defs
index 9b5ed2ee421..0291e7b30f1 100644
--- a/gdb/exc_request.defs
+++ b/gdb/exc_request.defs
@@ -48,4 +48,4 @@ simpleroutine exception_raise_request (
task : mach_port_t;
exception : integer_t;
code : integer_t;
- subcode : integer_t);
+ subcode : rpc_long_integer_t);
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 0add13e3b89..aba1034396f 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -134,7 +134,8 @@ static struct inf *make_inf ();
struct exc_state
{
int exception; /* The exception code. */
- int code, subcode;
+ int code;
+ long subcode;
mach_port_t handler; /* The real exception port to handle this. */
mach_port_t reply; /* The reply port from the exception call. */
};
@@ -389,7 +390,7 @@ gnu_nat_target::proc_get_exception_port (struct proc * proc, mach_port_t * port)
kern_return_t
gnu_nat_target::proc_set_exception_port (struct proc * proc, mach_port_t port)
{
- proc_debug (proc, "setting exception port: %lu", port);
+ proc_debug (proc, "setting exception port: %u", port);
if (proc_is_task (proc))
return task_set_exception_port (proc->port, port);
else
@@ -429,7 +430,7 @@ gnu_nat_target::proc_steal_exc_port (struct proc *proc, mach_port_t exc_port)
{
kern_return_t err = 0;
- proc_debug (proc, "inserting exception port: %lu", exc_port);
+ proc_debug (proc, "inserting exception port: %u", exc_port);
if (cur_exc_port != exc_port)
/* Put in our exception port. */
@@ -450,7 +451,7 @@ gnu_nat_target::proc_steal_exc_port (struct proc *proc, mach_port_t exc_port)
proc->saved_exc_port = cur_exc_port;
}
- proc_debug (proc, "saved exception port: %lu", proc->saved_exc_port);
+ proc_debug (proc, "saved exception port: %u", proc->saved_exc_port);
if (!err)
proc->exc_port = exc_port;
@@ -562,11 +563,11 @@ gnu_nat_target::make_proc (struct inf *inf, mach_port_t port, int tid)
MACH_MSG_TYPE_MAKE_SEND_ONCE,
&prev_port);
if (err)
- warning (_("Couldn't request notification for port %lu: %s"),
+ warning (_("Couldn't request notification for port %u: %s"),
port, safe_strerror (err));
else
{
- proc_debug (proc, "notifications to: %lu", inf->event_port);
+ proc_debug (proc, "notifications to: %u", inf->event_port);
if (prev_port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), prev_port);
}
@@ -741,7 +742,7 @@ gnu_nat_target::inf_set_pid (struct inf *inf, pid_t pid)
pid, safe_strerror (err));
}
- inf_debug (inf, "setting task: %lu", task_port);
+ inf_debug (inf, "setting task: %u", task_port);
if (inf->pause_sc)
task_suspend (task_port);
@@ -1072,7 +1073,7 @@ gnu_nat_target::inf_validate_procs (struct inf *inf)
else
inf->threads = thread;
last = thread;
- proc_debug (thread, "new thread: %lu", threads[i]);
+ proc_debug (thread, "new thread: %u", threads[i]);
ptid = ptid_t (inf->pid, thread->tid, 0);
@@ -1337,8 +1338,8 @@ gnu_nat_target::inf_signal (struct inf *inf, enum gdb_signal sig)
struct exc_state *e = &w->exc;
inf_debug (inf, "passing through exception:"
- " task = %lu, thread = %lu, exc = %d"
- ", code = %d, subcode = %d",
+ " task = %u, thread = %u, exc = %d"
+ ", code = %d, subcode = %ld",
w->thread->port, inf->task->port,
e->exception, e->code, e->subcode);
err =
@@ -1631,13 +1632,13 @@ gnu_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
kern_return_t
S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
thread_t thread_port, task_t task_port,
- int exception, int code, int subcode)
+ int exception, int code, long subcode)
{
struct inf *inf = waiting_inf;
struct proc *thread = inf_port_to_thread (inf, thread_port);
inf_debug (waiting_inf,
- "thread = %lu, task = %lu, exc = %d, code = %d, subcode = %d",
+ "thread = %u, task = %u, exc = %d, code = %d, subcode = %ld",
thread_port, task_port, exception, code, subcode);
if (!thread)
@@ -1671,13 +1672,13 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
{
if (thread->exc_port == port)
{
- inf_debug (waiting_inf, "Handler is thread exception port <%lu>",
+ inf_debug (waiting_inf, "Handler is thread exception port <%u>",
thread->saved_exc_port);
inf->wait.exc.handler = thread->saved_exc_port;
}
else
{
- inf_debug (waiting_inf, "Handler is task exception port <%lu>",
+ inf_debug (waiting_inf, "Handler is task exception port <%u>",
inf->task->saved_exc_port);
inf->wait.exc.handler = inf->task->saved_exc_port;
gdb_assert (inf->task->exc_port == port);
@@ -1727,7 +1728,7 @@ do_mach_notify_dead_name (mach_port_t notify, mach_port_t dead_port)
{
struct inf *inf = waiting_inf;
- inf_debug (waiting_inf, "port = %lu", dead_port);
+ inf_debug (waiting_inf, "port = %u", dead_port);
if (inf->task && inf->task->port == dead_port)
{
@@ -2357,7 +2358,7 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
/* Check for holes in memory. */
if (old_address != region_address)
{
- warning (_("No memory at 0x%lx. Nothing written"),
+ warning (_("No memory at 0x%zx. Nothing written"),
old_address);
err = KERN_SUCCESS;
length = 0;
@@ -2366,7 +2367,7 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
if (!(max_protection & VM_PROT_WRITE))
{
- warning (_("Memory at address 0x%lx is unwritable. "
+ warning (_("Memory at address 0x%zx is unwritable. "
"Nothing written"),
old_address);
err = KERN_SUCCESS;
@@ -2870,7 +2871,7 @@ gnu_nat_target::steal_exc_port (struct proc *proc, mach_port_t name)
name, MACH_MSG_TYPE_COPY_SEND,
&port, &port_type);
if (err)
- error (_("Couldn't extract send right %lu from inferior: %s"),
+ error (_("Couldn't extract send right %u from inferior: %s"),
name, safe_strerror (err));
if (proc->saved_exc_port)
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Hurd port: update interface to match upstream and fix warnings.
2024-02-07 6:53 [PATCH] Hurd port: update interface to match upstream and fix warnings Flavio Cruz
@ 2024-02-07 16:47 ` Simon Marchi
2024-02-07 17:01 ` Samuel Thibault
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2024-02-07 16:47 UTC (permalink / raw)
To: Flavio Cruz, bug-hurd, gdb-patches
On 2/7/24 01:53, Flavio Cruz wrote:
> We have recently updated the interface for raising exceptions to use
> long [1] and updated mach_port_t to be "unsigned int". This patches fixes
> those problems and will help us port GDB to Hurd x86_64.
>
> Tested on Hurd i686 and x86_64.
>
> [1] https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/include/mach/exc.defs
I take it that you are not too concerned with backwards compatibility
with previous versions of Hurd (compiling new GDBs on old Hurds)? If
so, this is fine with me.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Hurd port: update interface to match upstream and fix warnings.
2024-02-07 16:47 ` Simon Marchi
@ 2024-02-07 17:01 ` Samuel Thibault
0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2024-02-07 17:01 UTC (permalink / raw)
To: Simon Marchi; +Cc: Flavio Cruz, bug-hurd, gdb-patches
Simon Marchi, le mer. 07 févr. 2024 11:47:30 -0500, a ecrit:
> On 2/7/24 01:53, Flavio Cruz wrote:
> > We have recently updated the interface for raising exceptions to use
> > long [1] and updated mach_port_t to be "unsigned int". This patches fixes
> > those problems and will help us port GDB to Hurd x86_64.
> >
> > Tested on Hurd i686 and x86_64.
> >
> > [1] https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/include/mach/exc.defs
>
> I take it that you are not too concerned with backwards compatibility
> with previous versions of Hurd (compiling new GDBs on old Hurds)?
We don't have any other 64bit version of the Hurd, and for the 32bit
version this is a no-op.
> If so, this is fine with me.
>
> Approved-By: Simon Marchi <simon.marchi@efficios.com>
Thanks!
Samuel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-07 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 6:53 [PATCH] Hurd port: update interface to match upstream and fix warnings Flavio Cruz
2024-02-07 16:47 ` Simon Marchi
2024-02-07 17:01 ` Samuel Thibault
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).