From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 3FEAD384AB5B for ; Tue, 23 Apr 2024 19:23:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FEAD384AB5B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FEAD384AB5B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713900218; cv=none; b=QbwXnBkYNQQUPz+DOsKoqOQYth63Y5zjHNp6X0NNEaMJS3c6nw+eQoiAcK6aFtE4AZG0cJShzcEocTJ4irfAoWGaV/FCkB34MibffChJkJVxnDqOEylZlDA/bMW4I7fVZh9sI2ZxWhQODmNvU71xv/Dc0eAnmlHxFpsF2iFhww8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713900218; c=relaxed/simple; bh=1NfYdea3wVtEigZcppv9qEHVweU8FCyh5EZpsiw0CfI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KKrq6naznOVKT6rHUFmiautQyhFQ+L57rAEsaqyI85sSSG5ebFZloU0OstSFmGW0hoVzpr92GuaIzA9zOH7ayL6+AGSYtucey0ybwxS5y5Z6yBGE2Z4Vu1p3RFkx1rLxlMxmWvGD9vLjq45Z6Ra7nsYifhiKncR5kmJYDOzSXuE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 43NJNS5w060716 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 15:23:33 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NJNS5w060716 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713900214; bh=K1YQmQSrwgn8IPhutMbEGdztrKHazJzgDlUblDRwAPA=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=V9rklWF6O/5ve79ELJPMtTaXfwkO3UWm6BbfT6j+ZDLhQ5hmP0Ot6W8yuk1jJbi1e 9h10KBKUQQe0goaNr/R39u/zbhddhK4ySrEUpeHFcSehhJmAti7QXUsMCx74WT0CQ5 Bh1rciSl4ez4aYlqZuGjkxVjXayImPvGuQ81eevM= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (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 ESMTPSA id 8EFDE1E0AC; Tue, 23 Apr 2024 15:23:28 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/4] gdb: move execute function declarations from gdbcmd.h to top.h Date: Tue, 23 Apr 2024 15:22:41 -0400 Message-ID: <20240423192327.2750109-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423192327.2750109-1-simon.marchi@polymtl.ca> References: <20240423192327.2750109-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 19:23:28 +0000 X-Spam-Status: No, score=-3188.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: These functions are implemented in top.c, move their declarations to top.h. Change-Id: I8893ef91d955156a6530734fefe8002d78c3e5fc --- gdb/complaints.c | 1 + gdb/gdbcmd.h | 31 ------------------------------- gdb/printcmd.c | 1 + gdb/record-btrace.c | 1 + gdb/record-full.c | 1 + gdb/record.c | 1 + gdb/stack.c | 1 + gdb/thread.c | 1 + gdb/top.c | 13 +++++++------ gdb/top.h | 24 ++++++++++++++++++++++++ 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/gdb/complaints.c b/gdb/complaints.c index d3c72df6d41f..7dd5205adf83 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -21,6 +21,7 @@ #include "command.h" #include "gdbcmd.h" #include "run-on-main-thread.h" +#include "top.h" #include "gdbsupport/selftest.h" #include #include diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index 8a1f6f200520..c212a0caf736 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -29,37 +29,6 @@ #include "cli/cli-script.h" #include "cli/cli-cmds.h" -extern void execute_command (const char *, int); - -/* Run FN. Sends its output to FILE, do not display it to the screen. - The global BATCH_FLAG will be temporarily set to true. */ - -extern void execute_fn_to_ui_file (struct ui_file *file, std::function fn); - -/* Run FN. Capture its output into the returned string, do not display it - to the screen. The global BATCH_FLAG will temporarily be set to true. - When TERM_OUT is true the output is collected with terminal behaviour - (e.g. with styling). When TERM_OUT is false raw output will be collected - (e.g. no styling). */ - -extern void execute_fn_to_string (std::string &res, - std::function fn, bool term_out); - -/* As execute_fn_to_ui_file, but run execute_command for P and FROM_TTY. */ - -extern void execute_command_to_ui_file (struct ui_file *file, - const char *p, int from_tty); - -/* As execute_fn_to_string, but run execute_command for P and FROM_TTY. */ - -extern void execute_command_to_string (std::string &res, const char *p, - int from_tty, bool term_out); - -/* As execute_command_to_string, but ignore resulting string. */ - -extern void execute_command_to_string (const char *p, - int from_tty, bool term_out); - extern void print_command_line (struct command_line *, unsigned int, struct ui_file *); extern void print_command_lines (struct ui_out *, diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 66669f105c5c..25e391b15d5c 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -22,6 +22,7 @@ #include "frame.h" #include "symtab.h" #include "gdbtypes.h" +#include "top.h" #include "value.h" #include "language.h" #include "c-lang.h" diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 0ef1dfbe652f..aac59ee6a6dc 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -28,6 +28,7 @@ #include "observable.h" #include "cli/cli-utils.h" #include "source.h" +#include "top.h" #include "ui-out.h" #include "symtab.h" #include "filenames.h" diff --git a/gdb/record-full.c b/gdb/record-full.c index 9d8c4ee438fd..d288eb957fee 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -39,6 +39,7 @@ #include "gdbsupport/gdb_unlinker.h" #include "gdbsupport/byte-vector.h" #include "async-event.h" +#include "top.h" #include "valprint.h" #include "interps.h" diff --git a/gdb/record.c b/gdb/record.c index 5b1093dd12ee..2059fb7ea0cf 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -26,6 +26,7 @@ #include "cli/cli-utils.h" #include "disasm.h" #include "interps.h" +#include "top.h" #include diff --git a/gdb/stack.c b/gdb/stack.c index d1832540d624..fae1fce1c39f 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -19,6 +19,7 @@ #include "event-top.h" #include "extract-store-integer.h" +#include "top.h" #include "value.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/thread.c b/gdb/thread.c index 60a1bef8cf0a..43c28be384ff 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -24,6 +24,7 @@ #include "frame.h" #include "inferior.h" #include "gdbsupport/environ.h" +#include "top.h" #include "value.h" #include "target.h" #include "gdbthread.h" diff --git a/gdb/top.c b/gdb/top.c index d01a0c206cc9..ee45f48b4fdd 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -598,9 +598,10 @@ execute_command (const char *p, int from_tty) cleanup_if_error.release (); } -/* See gdbcmd.h. */ +/* Run FN. Send its output to FILE, do not display it to the screen. + The global BATCH_FLAG will be temporarily set to true. */ -void +static void execute_fn_to_ui_file (struct ui_file *file, std::function fn) { /* GDB_STDOUT should be better already restored during these @@ -627,7 +628,7 @@ execute_fn_to_ui_file (struct ui_file *file, std::function fn) } } -/* See gdbcmd.h. */ +/* See top.h. */ void execute_fn_to_string (std::string &res, std::function fn, @@ -650,7 +651,7 @@ execute_fn_to_string (std::string &res, std::function fn, res = str_file.release (); } -/* See gdbcmd.h. */ +/* See top.h. */ void execute_command_to_ui_file (struct ui_file *file, @@ -659,7 +660,7 @@ execute_command_to_ui_file (struct ui_file *file, execute_fn_to_ui_file (file, [=]() { execute_command (p, from_tty); }); } -/* See gdbcmd.h. */ +/* See top.h. */ void execute_command_to_string (std::string &res, const char *p, int from_tty, @@ -669,7 +670,7 @@ execute_command_to_string (std::string &res, const char *p, int from_tty, term_out); } -/* See gdbcmd.h. */ +/* See top.h. */ void execute_command_to_string (const char *p, int from_tty, diff --git a/gdb/top.h b/gdb/top.h index 68c637a03d83..dc3f2aaf6141 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -47,6 +47,30 @@ extern void quit_command (const char *, int); extern void quit_cover (void); extern void execute_command (const char *, int); +/* Run FN. Capture its output into the returned string, do not display it + to the screen. The global BATCH_FLAG will temporarily be set to true. + When TERM_OUT is true the output is collected with terminal behaviour + (e.g. with styling). When TERM_OUT is false raw output will be collected + (e.g. no styling). */ + +extern void execute_fn_to_string (std::string &res, + std::function fn, bool term_out); + +/* As execute_fn_to_ui_file, but run execute_command for P and FROM_TTY. */ + +extern void execute_command_to_ui_file (struct ui_file *file, + const char *p, int from_tty); + +/* As execute_fn_to_string, but run execute_command for P and FROM_TTY. */ + +extern void execute_command_to_string (std::string &res, const char *p, + int from_tty, bool term_out); + +/* Same as the above, but ignore resulting string. */ + +extern void execute_command_to_string (const char *p, + int from_tty, bool term_out); + /* If the interpreter is in sync mode (we're running a user command's list, running command hooks or similars), and we just ran a synchronous command that started the target, wait for that command -- 2.44.0