* [PATCH] apply debug-remap to file names in .su files
@ 2023-02-13 19:27 Rasmus Villemoes
2023-03-03 12:49 ` Rasmus Villemoes
2023-04-30 5:10 ` Jeff Law
0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2023-02-13 19:27 UTC (permalink / raw)
To: gcc-patches; +Cc: Jeff Law, Rasmus Villemoes
The .su files generated with -fstack-usage are arguably debug info. In
order to make builds more reproducible, apply the same remapping logic
to the recorded file names as for when producing the debug info
embedded in the object files.
To this end, teach print_decl_identifier() a new
PRINT_DECL_REMAP_DEBUG flag and use that from output_stack_usage_1().
gcc/ChangeLog:
* print-tree.h (PRINT_DECL_REMAP_DEBUG): New flag.
* print-tree.cc (print_decl_identifier): Implement it.
* toplev.cc (output_stack_usage_1): Use it.
---
gcc/print-tree.cc | 6 +++++-
gcc/print-tree.h | 1 +
gcc/toplev.cc | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 1f3afcbbc86..ccecd3dc6a7 100644
--- a/gcc/print-tree.cc
+++ b/gcc/print-tree.cc
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-cfg.h"
#include "dumpfile.h"
#include "print-tree.h"
+#include "file-prefix-map.h"
/* Define the hash table of nodes already seen.
Such nodes are not repeated; brief cross-references are used. */
@@ -1065,7 +1066,10 @@ print_decl_identifier (FILE *file, tree decl, int flags)
{
expanded_location loc
= expand_location (DECL_SOURCE_LOCATION (decl));
- fprintf (file, "%s:%d:%d", loc.file, loc.line, loc.column);
+ const char *f = flags & PRINT_DECL_REMAP_DEBUG
+ ? remap_debug_filename (loc.file)
+ : loc.file;
+ fprintf (file, "%s:%d:%d", f, loc.line, loc.column);
}
needs_colon = true;
}
diff --git a/gcc/print-tree.h b/gcc/print-tree.h
index 7683730484f..dc5a69b7a30 100644
--- a/gcc/print-tree.h
+++ b/gcc/print-tree.h
@@ -45,6 +45,7 @@ extern void indent_to (FILE *, int);
#define PRINT_DECL_ORIGIN 0x1
#define PRINT_DECL_NAME 0x2
#define PRINT_DECL_UNIQUE_NAME 0x4
+#define PRINT_DECL_REMAP_DEBUG 0x8
extern void print_decl_identifier (FILE *, tree, int flags);
#endif // GCC_PRINT_TREE_H
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 4c15d4f542e..d76571f60e8 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -829,7 +829,8 @@ output_stack_usage_1 (FILE *cf)
if (stack_usage_file)
{
print_decl_identifier (stack_usage_file, current_function_decl,
- PRINT_DECL_ORIGIN | PRINT_DECL_NAME);
+ PRINT_DECL_ORIGIN | PRINT_DECL_NAME
+ | PRINT_DECL_REMAP_DEBUG);
fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n",
stack_usage, stack_usage_kind_str[stack_usage_kind]);
}
--
2.37.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] apply debug-remap to file names in .su files
2023-02-13 19:27 [PATCH] apply debug-remap to file names in .su files Rasmus Villemoes
@ 2023-03-03 12:49 ` Rasmus Villemoes
2023-04-30 5:10 ` Jeff Law
1 sibling, 0 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2023-03-03 12:49 UTC (permalink / raw)
To: gcc-patches; +Cc: Jeff Law
On 13/02/2023 20.27, Rasmus Villemoes wrote:
> The .su files generated with -fstack-usage are arguably debug info. In
> order to make builds more reproducible, apply the same remapping logic
> to the recorded file names as for when producing the debug info
> embedded in the object files.
>
> To this end, teach print_decl_identifier() a new
> PRINT_DECL_REMAP_DEBUG flag and use that from output_stack_usage_1().
>
ping
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] apply debug-remap to file names in .su files
2023-02-13 19:27 [PATCH] apply debug-remap to file names in .su files Rasmus Villemoes
2023-03-03 12:49 ` Rasmus Villemoes
@ 2023-04-30 5:10 ` Jeff Law
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2023-04-30 5:10 UTC (permalink / raw)
To: Rasmus Villemoes, gcc-patches; +Cc: Rasmus Villemoes
On 2/13/23 12:27, Rasmus Villemoes wrote:
> The .su files generated with -fstack-usage are arguably debug info. In
> order to make builds more reproducible, apply the same remapping logic
> to the recorded file names as for when producing the debug info
> embedded in the object files.
>
> To this end, teach print_decl_identifier() a new
> PRINT_DECL_REMAP_DEBUG flag and use that from output_stack_usage_1().
>
> gcc/ChangeLog:
>
> * print-tree.h (PRINT_DECL_REMAP_DEBUG): New flag.
> * print-tree.cc (print_decl_identifier): Implement it.
> * toplev.cc (output_stack_usage_1): Use it.
OK for the trunk.
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-30 5:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 19:27 [PATCH] apply debug-remap to file names in .su files Rasmus Villemoes
2023-03-03 12:49 ` Rasmus Villemoes
2023-04-30 5:10 ` Jeff Law
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).