From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ye9TIdk992rfEgkAWB0awg (envelope-from ) for ; Fri, 13 Nov 2026 11:42:01 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=AmsuP32b; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 79CD91E0BC; Fri, 13 Nov 2026 11:42:01 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7B2FB1E087 for ; Fri, 13 Nov 2026 11:41:58 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 170E54BCA41F for ; Fri, 13 Nov 2026 16:41:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 170E54BCA41F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=AmsuP32b Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id EAD424BCA41F for ; Fri, 13 Nov 2026 16:41:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EAD424BCA41F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EAD424BCA41F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794588091; cv=none; b=g0YiUveu/z1ADj9e1UWTpCM5+dqLQ+YQUqcWyoCY5w50wvJOK7Ynr7WJSRQuCDJb0aH27VCcfw97toxXsFmRytwpWinATWflNLtuLUqDUVaEe9tMkAnxud1n1rTuOEHngSlMU1NLMfsOtLJY0DTmsFRiN3GzCgHOqgW/eCtQSzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794588091; c=relaxed/simple; bh=8WmLYleHTHxrZdoAjWF9Nuok075pAnUJz5l7u6KtZHw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=U+1/nM29Ldrx5ZBKxMCoRWNvYjeXqXuWxKzH+WaoAEhfC5v+Z/4SObvwuL+Od8Vg2u46WjErcRHBCgkUTwCAvYLfa6IIPSxOnsZLa/RL5LNuR12sn0CKKoTxKu0GTgZdzBIz0zmpkAwkMNTkXktQK2cqYbPgVAM7kM5LiMe7pSA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=AmsuP32b DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAD424BCA41F Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-492f0a1b685so1145138f8f.0 for ; Fri, 13 Nov 2026 08:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1794588090; x=1795192890; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kBNkXHe420zUDycfn6gYXONnuwYPb4jvesuZ6vO6LxY=; b=AmsuP32bbMvsXjzUf3pWFQ+px23qKycp1fbzosetacw4pQuITXeo+VAn1e0q/+Ntd3 AUBdL+lQ/PfyRCqGMLbJj7shR6Zy+QhogtynrhmZUjws6KljJm71SZ0lFvEvkrnUlC3R VpoyveEBFkEr/Zpp7/HukwceYBbWkWXz2Uypv5hLyUb+ItfLRSzwsiHsj3UEds1Mi8Bz CnUTg42ssAf92pQN9kCzsxxYg+7k9qyt01j3pTyih5gUXThVoxvcRMrOVMOZIGJpcP3r oJaDq/SzgWkZvVUmRzOQzvL09Jti6aZEAN2+09TFP7XNzmbo23rpqcJ3RxUuU0c2gcwh RDlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794588090; x=1795192890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=kBNkXHe420zUDycfn6gYXONnuwYPb4jvesuZ6vO6LxY=; b=nNu1uN6wACSxv5lySn/CwhWnnfXaamk3YCndXUxrSvqqdX1BdZTvrmJ2C1CGjTf10k vEgCTJ+EO3o7r11jxYiPyouS/7/P5kTU2lEwriJ2bBnux+E+W+jEXsGzSt7yDH2Urp5a EshJlIB0czz+XhJLjzPLpOiWLGomAd0XALrtsgXEhc7HHCmTEf1k+L72b13nH15DvnEA P921l8DIlehriUzluvLL+4AxIF/o1M7xtF11JAVzY+8KI+/iyfds6HvEhloYbr6dEHhc 5x+DguLGLcxVaDQABJbnv6Lccjm0qssid7lihZ0Jty0htMibAqZbUJk0mWrTmRmXe8ci jfnA== X-Gm-Message-State: APuU4Z/5o8cakcbsPEaSQv1y5gSpOHwVaZkPlJtxWtdH5SSnxXwk2dFc U2Aj7Ve+VMWgDOIvgWnzlBXbQg2VsQFFfRaDnvhgxR5JFdI5hCk7lAyo5WkWNfLI1IX5Um8MVmG WA0o2eg== X-Gm-Gg: AYBFou2gWGiLsSMh/WId6fwSpzF7TZqhbXRlyCoTXyHp2bfkLZvGYX4zoxcX0Y+vV4g hbtWdIkgkvZoKGtGcxE5EnKL0qw7f5nYgHPTFNERo7F8lSab2A2F4aXRVvAHk3T2ljfCqCbBzcB 2ooVwV4X3NVihSmzMjIfixNxwKC9Hxkon9fAOQpW4zJVZwfy9U4Dr7bU5NXDjBgzivy5ZrUyrV9 7cOJaIglgTo4WjdrGwjrUHb9C6754XOzN7OJlZl7rBy9o4w1rnsortmZAvmCx51VopIkoeaqG2f CUUYKkyDyQ+5ibZXNOzd3IeL4G/BTdJ5QL81mklJjpYsby+2U+UD26104XkDtV+89mcaWh19wkY voEg0LlcGZvwxtA9rRS9XBOOAuvDfyYw/2ZeD/podsmJwgfoVNeWc5WNn4q4MJhX5uNZPbtCQte GvUZH47PlBWMwPMIPzdeNYYhmS2UshVQJxJuGOph8mO4aQPgb1LBlg1dvqXKzOa00u+Zl4pwUgi Sgpb3+yvJgcsojXp8X5FHtFuDImmcqprSm6YuAPhLlFvNKXMCFhItFUfV/Z/0J9BrZLPxVRMxpa Fa1J9SfhRg7vIe15H+6h7Am17LFC+HZCCkUW3AsuGHZeACuiXa6ZdZrwDm0= X-Received: by 2002:a05:6000:4707:b0:498:c419:3728 with SMTP id ffacd0b85a97d-49c713ae367mr6859870f8f.22.1794588089538; Fri, 13 Nov 2026 08:41:29 -0800 (PST) Received: from localhost.localdomain ([2.57.72.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c5d03b10fsm7059356f8f.1.2026.11.13.08.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2026 08:41:29 -0800 (PST) From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= To: gdb-patches@sourceware.org Cc: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= , Simon Marchi Subject: [PATCH v4 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c Date: Fri, 13 Nov 2026 17:40:38 +0100 Message-ID: <747b666d5ed99d79a84f54b04d087fc56de70d41.1794585020.git.legouguec@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org Also move the documentation for these functions to the new header, instead of at the top of their definition, to align with our current practice. I tried to honor our guideline that .c files should not rely on indirect inclusion, hence I only removed #include "ada-lang.h" directives in .c files that, as far as I could tell, only rely on symbols declared in ada-tasks.h. --- gdb/Makefile.in | 1 + gdb/ada-lang.h | 19 ----------- gdb/ada-tasks.c | 26 ++++----------- gdb/ada-tasks.h | 68 ++++++++++++++++++++++++++++++++++++++ gdb/break-cond-parse.c | 2 +- gdb/breakpoint.c | 1 + gdb/guile/scm-breakpoint.c | 2 +- gdb/mi/mi-main.c | 2 +- gdb/python/py-breakpoint.c | 2 +- gdb/ravenscar-thread.c | 1 + 10 files changed, 82 insertions(+), 42 deletions(-) create mode 100644 gdb/ada-tasks.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 41dbb814787..d7964e67cab 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1285,6 +1285,7 @@ HFILES_NO_SRCDIR = \ ada-exp-parser.h \ ada-exp.h \ ada-lang.h \ + ada-tasks.h \ addrmap.h \ alpha-bsd-tdep.h \ alpha-tdep.h \ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index cf89a90f2f5..96043b96b92 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -362,25 +362,6 @@ struct ada_exc_info extern std::vector ada_exceptions_list (const char *regexp); -/* Tasking-related: ada-tasks.c */ - -extern bool valid_task_id (int); - -extern struct ada_task_info *ada_get_task_info_from_ptid (ptid_t ptid); - -extern int ada_get_task_number (thread_info *thread); - -using ada_task_list_iterator_ftype - = gdb::function_view; -extern void iterate_over_live_ada_tasks - (ada_task_list_iterator_ftype iterator); - -extern const char *ada_get_tcb_types_info (void); - -extern void print_ada_task_info (struct ui_out *uiout, - const char *taskno_str, - struct inferior *inf); - /* Look for a symbol for an overloaded operator for the operation OP. PARSE_COMPLETION is true if currently parsing for completion. NARGS and ARGVEC describe the arguments to the call. Returns a diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 7dfa819a937..503563de42a 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -20,6 +20,7 @@ #include "cli/cli-cmds.h" #include "target.h" #include "ada-lang.h" +#include "ada-tasks.h" #include "gdbcore.h" #include "inferior.h" #include "gdbthread.h" @@ -317,8 +318,7 @@ get_ada_tasks_inferior_data (struct inferior *inf) return &ada_tasks_inferior_data_handle.try_emplace (inf); } -/* Return the task number of the task whose thread is THREAD, or zero - if the task could not be found. */ +/* See ada-tasks.h. */ int ada_get_task_number (thread_info *thread) @@ -354,7 +354,7 @@ get_task_number_from_id (CORE_ADDR task_id, struct inferior *inf) return 0; } -/* Return true if TASK_NUM is a valid task number. */ +/* See ada-tasks.h. */ bool valid_task_id (int task_num) @@ -375,8 +375,7 @@ ada_task_is_alive (const struct ada_task_info *task_info) return (task_info->state != Terminated); } -/* Search through the list of known tasks for the one whose ptid is - PTID, and return it. Return NULL if the task was not found. */ +/* See ada-tasks.h. */ struct ada_task_info * ada_get_task_info_from_ptid (ptid_t ptid) @@ -395,8 +394,7 @@ ada_get_task_info_from_ptid (ptid_t ptid) return NULL; } -/* Call the ITERATOR function once for each Ada task that hasn't been - terminated yet. */ +/* See ada-tasks.h. */ void iterate_over_live_ada_tasks (ada_task_list_iterator_ftype iterator) @@ -480,14 +478,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len) dest[len] = '\0'; } -/* Get, from the debugging information, the type description of all types - related to the Ada Task Control Block that are needed in order to - read the list of known tasks in the Ada runtime. If all of the info - needed to do so is found, then save that info in the module's per- - program-space data, and return NULL. Otherwise, if any information - cannot be found, leave the per-program-space data untouched, and - return an error message explaining what was missing (that error - message does NOT need to be deallocated). */ +/* See ada-tasks.h. */ const char * ada_get_tcb_types_info (void) @@ -1036,10 +1027,7 @@ ada_build_task_list () return data->task_list.size (); } -/* Print a table providing a short description of all Ada tasks - running inside inferior INF. If ARG_STR is set, it will be - interpreted as a task number, and the table will be limited to - that task only. */ +/* See ada-tasks.h. */ void print_ada_task_info (struct ui_out *uiout, diff --git a/gdb/ada-tasks.h b/gdb/ada-tasks.h new file mode 100644 index 00000000000..66870ac323f --- /dev/null +++ b/gdb/ada-tasks.h @@ -0,0 +1,68 @@ +/* Helper routines for Ada tasking support in GBD. + + Copyright (C) 2026 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_ADA_TASKS_H +#define GDB_ADA_TASKS_H + +/* Return true if TASK_NUM is a valid task number. */ + +extern bool valid_task_id (int task_num); + +/* Search through the list of known tasks for the one whose ptid is + PTID, and return it. Return NULL if the task was not found. */ + +extern struct ada_task_info *ada_get_task_info_from_ptid (ptid_t ptid); + +struct thread_info; + +/* Return the task number of the task whose thread is THREAD, or zero + if the task could not be found. */ + +extern int ada_get_task_number (thread_info *thread); + +using ada_task_list_iterator_ftype + = gdb::function_view; + +/* Call the ITERATOR function once for each Ada task that hasn't been + terminated yet. */ + +extern void iterate_over_live_ada_tasks + (ada_task_list_iterator_ftype iterator); + +/* Get, from the debugging information, the type description of all types + related to the Ada Task Control Block that are needed in order to + read the list of known tasks in the Ada runtime. If all of the info + needed to do so is found, then save that info in the module's per- + program-space data, and return NULL. Otherwise, if any information + cannot be found, leave the per-program-space data untouched, and + return an error message explaining what was missing (that error + message does NOT need to be deallocated). */ + +extern const char *ada_get_tcb_types_info (); + +/* Print a table providing a short description of all Ada tasks + running inside inferior INF. If ARG_STR is set, it will be + interpreted as a task number, and the table will be limited to + that task only. */ + +extern void print_ada_task_info (struct ui_out *uiout, + const char *taskno_str, + struct inferior *inf); + +#endif /* GDB_ADA_TASKS_H */ diff --git a/gdb/break-cond-parse.c b/gdb/break-cond-parse.c index f552c171c05..fa532f21669 100644 --- a/gdb/break-cond-parse.c +++ b/gdb/break-cond-parse.c @@ -21,7 +21,7 @@ #include "scoped-mock-context.h" #include "break-cond-parse.h" #include "tid-parse.h" -#include "ada-lang.h" +#include "ada-tasks.h" /* When parsing tokens from a string, which direction are we parsing? diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a23f5998b20..6e993f332b4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -52,6 +52,7 @@ #include "observable.h" #include "memattr.h" #include "ada-lang.h" +#include "ada-tasks.h" #include "top.h" #include "ui.h" #include "valprint.h" diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index 5df2c00f5d3..911e13448a2 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -26,7 +26,7 @@ #include "gdbthread.h" #include "observable.h" #include "cli/cli-script.h" -#include "ada-lang.h" +#include "ada-tasks.h" #include "arch-utils.h" #include "language.h" #include "guile-internal.h" diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 42f5dcc3ded..f4bca4048d5 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -44,7 +44,7 @@ #include "valprint.h" #include "osdata.h" #include "tracepoint.h" -#include "ada-lang.h" +#include "ada-tasks.h" #include "linespec.h" #include "extension.h" #include "cli/cli-cmds.h" diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index ee7276f1792..2a539513502 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -27,7 +27,7 @@ #include "gdbthread.h" #include "observable.h" #include "cli/cli-script.h" -#include "ada-lang.h" +#include "ada-tasks.h" #include "arch-utils.h" #include "language.h" #include "location.h" diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index b5e0979a7f1..bb3d7f9e847 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -21,6 +21,7 @@ #include "gdbcore.h" #include "gdbthread.h" #include "ada-lang.h" +#include "ada-tasks.h" #include "target.h" #include "inferior.h" #include "command.h" -- 2.43.0