From patchwork Wed Feb 7 06:53:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Cruz X-Patchwork-Id: 85387 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA4CC3858403 for ; Wed, 7 Feb 2024 06:54:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by sourceware.org (Postfix) with ESMTPS id 52F903858C53 for ; Wed, 7 Feb 2024 06:53:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52F903858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52F903858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::835 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707288825; cv=none; b=rnmdhAqVuptX8VeJjQIMQ9TZaWFU533X/NPP91OZKO50XR5QLQDikVjqwbpvJkgIGVxmkQ/4G6bhg9clzIksdwPkYu7+bLfjz/ARHoNbVVnciJkMy4OJ2zK2dj3o8HNf0z5SMsMPq/9bLAywXT7X8Pw9n11P9TGBeUUi1vWHkes= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707288825; c=relaxed/simple; bh=KBMjxNTqSnFXmO7YvgHvNuDJdHjUTAsB0fyxLrGI04U=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=kh2mLSDZJzakun5sypmQ6+5lo/6IR1zQuaCs4phBlRWvTHD+T2TYo/3J56bj+HR01+0tgu3ZfPLrBjOdy5ZSSutDMvojeQw3MyLsfOHvLK/ckPdkd9TODIwybKzEe6g9JVtk7Gewx+mGMK9TCQ1qTZ9kSfkH1A2i9aJseYz7Rfo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-42ab03a5aeeso1401271cf.0 for ; Tue, 06 Feb 2024 22:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707288822; x=1707893622; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=xkmwyIJG43E0Yraph1Fn6IcyDJgyw3N1hgXi7Qbh4FE=; b=dgTodj2vhMli96gMntFiUwBmFO8NzPSipId+Lx20T3ACkSaef8aNmUCh9oqrn7Fc7O dhLunVyhmiO1dB9KTSh1wgq9uJ+Z8pgF0R1uZy0APmOWEQg0tj2e5IMNSNrx2GUUvR5J RtlOg38FLOj1qtj5WvaYA08n4q40ZLQ6Wg/WtZB+5Vwg3d2jaQFBs5hMse4Hq51GBtMj Q6vieBCPVxY/O5Dt7Ijoru8z5CEn6KyOBzKBy2QoQXxZSy5wSWkQwwt41dGzp44w0f5z ygq6CKEKjZqft9ucHcBrGRoEN3NE3/3BMbp1HCGs4rxEa9Cam88CnHyOg90K9P+cyMCP JzLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707288822; x=1707893622; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xkmwyIJG43E0Yraph1Fn6IcyDJgyw3N1hgXi7Qbh4FE=; b=e+XDrE53Iw/wkKjK+o1z2evvsuvTAzW2TXPkF6KzqH29kmTNGy8yaws4evet7IavuB rRVklBkuTBdcA8gPG753L+FYNAfs85KUT8FJU/FL8o/ZnrsTOE6FQ0MWBZJAr/Dan4qV EztomQ1LtSelUxg6kMYuJ0uBgqpR9NSS/f9OE5ODJfiddVqLG1UL/Ql/04j3XABOCaMo OKx2EY/4i10Qf7l8cvWqdarJF6cb/DZ1VjxE0PUjRpiImegsjXe+Nv9Z9FKlTDNrpf66 SBXwBUaK/vioNdw+EjnhirapXDpq2IqvyZH8FKBM7fK0A1qy4wNsxmjKzno2pS+dKIhq 3GUA== X-Gm-Message-State: AOJu0YyOW5UlMeDMbUiRFOYDm+c7tV+KZfdhfNM9DZrwaGB6Xj4suyx4 FItUQy0pLHHVZl43kzWaGzjDysuEyPaXz8YdjWW+H2mA9xgJLK1DeX3zLKI= X-Google-Smtp-Source: AGHT+IHfXg57mlhnpIbrZQpDhl2jDFzX1IVXSpZvB/ugZK25CYUvw+wKUX3Qohm1EfS2V+qMcywaSA== X-Received: by 2002:a05:622a:6dc8:b0:42c:30b:8bbe with SMTP id ir8-20020a05622a6dc800b0042c030b8bbemr4508511qtb.68.1707288822513; Tue, 06 Feb 2024 22:53:42 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU9Hd0ZIEOgCdHEWL929kzvtPIJJLKePNV3+oBeF49o1ePvLiWn6azScsLxOp9aXL0Sy/hkmeLu2ejXTiAoTb19JhErLa+JgsI5ow== Received: from jupiter.tail36e24.ts.net (dynamic-acs-24-154-253-225.zoominternet.net. [24.154.253.225]) by smtp.gmail.com with ESMTPSA id s26-20020a05622a1a9a00b0042ab59ccd6csm270847qtc.4.2024.02.06.22.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 22:53:41 -0800 (PST) Date: Wed, 7 Feb 2024 01:53:40 -0500 From: Flavio Cruz To: bug-hurd@gnu.org, gdb-patches@sourceware.org Subject: [PATCH] Hurd port: update interface to match upstream and fix warnings. Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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)