From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WZHgCBMG7mr0/CgAWB0awg (envelope-from ) for ; Fri, 06 Nov 2026 11:53:39 -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=AF98j2Uj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1E463378002; Fri, 06 Nov 2026 11:53:39 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 0B6491E023 for ; Fri, 06 Nov 2026 11:53:38 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2034C4BA23CC for ; Fri, 6 Nov 2026 16:53:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2034C4BA23CC 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=AF98j2Uj Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 862BB4BA2E08 for ; Fri, 6 Nov 2026 16:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 862BB4BA2E08 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 862BB4BA2E08 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793983972; cv=none; b=FLoIklm7k8Peuipr7xU+sldY6t/KIHgW79Clf6xnGIdppaa1XSmDWqqwqWnmVFEuknKiach1viNOmdET9i63nss/eTkbKTQznY5Mjmv26z5oA2WLxUAEicgkJuONuMGZ0muPKqiD4p+Q1tcIwvFgXuiRk3mSOi3zO46/pDC+tzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793983972; c=relaxed/simple; bh=1tqmykmgvNtLm53oRpIPyFnaBd1GaOzIsFQY78xOojo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EoyW7HeWIJAJ+9BTBKKbbdYo3zjYTSeVu9gd1NpONYoCPgjeAo+q8rGl49yUK6J3DvxY4LlMhCxaqLjoiHonmj/A6zXxvvEzB0TSXnnSehsNkCQAjC1E4yRBP8lYCjMoDlrDgrMHNLJF7g4abU/EZG9YDogvBI4N03owhIx7bOY= 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=AF98j2Uj DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 862BB4BA2E08 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-492f0a1b685so489164f8f.0 for ; Fri, 06 Nov 2026 08:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1793983971; x=1794588771; 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=Z0QIYf1xYrGajMgP/yWPRhB1o2m69XTJMmXAhRFfNC0=; b=AF98j2UjnO2GBpKcqpRB84S86oqzVZT0WLmygP5xTGuu4tv1s6aQ6S3lCNAUEqvkQw 3k9lb5PMc3a7cKIRLmqZCNfcPqmiQ87Gwedx6bK2LQqyZH4mQuyCxu1UBcDwRPwLCVBB +RlVkZ8gDzesHCiKX4kt4kflmD+cuhOujKwCnnmvjCZbD8kiBql2eBjnB9/cOuaPevz/ dhh2+tBIm6IQ5yE2HOSRXHCfwRcroiGFwkjt+jH8WTKdcdEKXFpskxX6/nGi/2Q7gnTw PFIMO0XLvm1uf+KA4fFRLGIm5NA1iVpVqemErbDg/Yd+kneXTwffzg2AwIWYKu6ov/4H qLow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793983971; x=1794588771; 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=Z0QIYf1xYrGajMgP/yWPRhB1o2m69XTJMmXAhRFfNC0=; b=riX9Y1ypcTGGz50tbP672UySJ+lFfu7YZk0+qn85tqNObVe+oNCmslk831CFIzeXtD e6Ie4iT7MSNnXuxP/4sfwDuIRNGplmuiHRXCKip5Efi/t4W4zRXDG8Bse8exlkoG94rP G+gMOmpKeHPTiuJCZ2SZ2mOx0uF9A+k0vWEh/jzqQ2kaWXvnKWm8lpVR68DxGtX9Sm+j SJAmvjGVBt615FnhreMjGwUGkM/9AExrcGIGsprGWbUeVzggJ631GlvxnU0Ll5ENs7OE tQKfrvu0y9su12teZcPm6VNvhLKy5NdogwqrvlIe8TYDW0NZ/kCmeidYCfSiMN7kUBTx GaYg== X-Gm-Message-State: APuU4Z/7QBtVxcKas/YnUz5X2bj4hYmuPzfAgIhubyNIRkFftKEDk3cv XcshcmXPQourp0hV5vp8dlsJ/Y7cIk1dCNJGPRv6b5TyyH57l4XiZl0ohz1EtCgUuhl51jUIWKV TIHeiKg== X-Gm-Gg: AYBFou20XoYVLWkLdardqp8z3Z0IjPTW1KNtxOSntYwozj8Iwn7VNBM5inlMqVv9fF7 VFZ1jczbqKeqyh3r8U9DcutZCeUz13hIrXKqWFTL8Tv9VfKK83m6/nBc5Sm2OMBAIns4Rr9oTsk Uv+QVqVPBADcZCP0V1ZfuRt1GdDHlHaNGYeRAyMjnbcsl9AyZShdElQuHkOXWVwoTi/88ngYlLT w1TVw/jZFAGNfKTL8R3jJXmgUCTNCHf84nONF+xxAAwagYpqrAHxtZd/Cw58hMMbOx4zgnp3kne y5NqQTSspkjXv0J60obF7gQTeI+ogU1Z1SjpwpP+uTn5cOrPFJMUmyj4kDTe332e2PQbF+zc2BM TbHE9UasceT2h2GY+LFEvUSOmpM+dfoi8mVA90ACnAy0DfTE52Cu+d/zz3YgmlYAA8X89YYelNS UOfOR20lfrKfNgYNXLIv9s9NWbNfT0WA2lMv8KwYa9P9ECFW3eOAf2p6WuAZm9YXszkCmowtk+6 HZHp7PPCtG2PuZB6emJwH/xc4T5jT0qdvLZ+Qkw+DMYtcoaL+xEYvHRzi5ubffO9CwBlwH+jwYv atEXQlXuNqPQfn5sH7Bd1d2q9DC74Olbz3PNrg== X-Received: by 2002:a05:6000:22c1:b0:48d:eec6:308b with SMTP id ffacd0b85a97d-492765a4011mr7143392f8f.21.1793983971081; Fri, 06 Nov 2026 08:52:51 -0800 (PST) Received: from localhost.localdomain ([2.57.72.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-492d7cc5e23sm4895956f8f.45.2026.11.06.08.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 08:52:50 -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 v3 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c Date: Fri, 6 Nov 2026 17:51:56 +0100 Message-ID: <7561007673151647213c12316b34961b5ee9f657.1793983731.git.legouguec@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20230127165337.1832937-1-legouguec@adacore.com> 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 | 72 ++++++++++++++++++++++++++++++++++++++ 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, 86 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..a9fa798a5c2 --- /dev/null +++ b/gdb/ada-tasks.h @@ -0,0 +1,72 @@ +/* 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 + +#include "gdbsupport/function-view.h" +#include "ada-lang.h" +#include "gdbthread.h" +#include "inferior.h" +#include "ui-out.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); + +/* 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 (void); + +/* 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 6a5e133087e..eefe7314152 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