cxxfilt 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /* Defs for interface to demanglers.
2
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
2
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
3
3
 
4
4
  This program is free software; you can redistribute it and/or
5
5
  modify it under the terms of the GNU Library General Public License
@@ -53,20 +53,24 @@ extern "C" {
53
53
  */
54
54
 
55
55
  #define DMGL_AUTO (1 << 8)
56
- #define DMGL_GNU (1 << 9)
57
- #define DMGL_LUCID (1 << 10)
58
- #define DMGL_ARM (1 << 11)
59
- #define DMGL_HP (1 << 12) /* For the HP aCC compiler;
60
- same as ARM except for
61
- template arguments, etc. */
62
- #define DMGL_EDG (1 << 13)
63
56
  #define DMGL_GNU_V3 (1 << 14)
64
57
  #define DMGL_GNAT (1 << 15)
65
58
  #define DMGL_DLANG (1 << 16)
66
59
  #define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style mangling. */
67
60
 
68
61
  /* If none of these are set, use 'current_demangling_style' as the default. */
69
- #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
62
+ #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
63
+
64
+ /* Disable a limit on the depth of recursion in mangled strings.
65
+ Note if this limit is disabled then stack exhaustion is possible when
66
+ demangling pathologically complicated strings. Bug reports about stack
67
+ exhaustion when the option is enabled will be rejected. */
68
+ #define DMGL_NO_RECURSE_LIMIT (1 << 18)
69
+
70
+ /* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as
71
+ the maximum depth of recursion allowed. It should be enough for any
72
+ real-world mangled name. */
73
+ #define DEMANGLE_RECURSION_LIMIT 2048
70
74
 
71
75
  /* Enumeration of possible demangling styles.
72
76
 
@@ -81,11 +85,6 @@ extern enum demangling_styles
81
85
  no_demangling = -1,
82
86
  unknown_demangling = 0,
83
87
  auto_demangling = DMGL_AUTO,
84
- gnu_demangling = DMGL_GNU,
85
- lucid_demangling = DMGL_LUCID,
86
- arm_demangling = DMGL_ARM,
87
- hp_demangling = DMGL_HP,
88
- edg_demangling = DMGL_EDG,
89
88
  gnu_v3_demangling = DMGL_GNU_V3,
90
89
  java_demangling = DMGL_JAVA,
91
90
  gnat_demangling = DMGL_GNAT,
@@ -97,11 +96,6 @@ extern enum demangling_styles
97
96
 
98
97
  #define NO_DEMANGLING_STYLE_STRING "none"
99
98
  #define AUTO_DEMANGLING_STYLE_STRING "auto"
100
- #define GNU_DEMANGLING_STYLE_STRING "gnu"
101
- #define LUCID_DEMANGLING_STYLE_STRING "lucid"
102
- #define ARM_DEMANGLING_STYLE_STRING "arm"
103
- #define HP_DEMANGLING_STYLE_STRING "hp"
104
- #define EDG_DEMANGLING_STYLE_STRING "edg"
105
99
  #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
106
100
  #define JAVA_DEMANGLING_STYLE_STRING "java"
107
101
  #define GNAT_DEMANGLING_STYLE_STRING "gnat"
@@ -112,11 +106,6 @@ extern enum demangling_styles
112
106
 
113
107
  #define CURRENT_DEMANGLING_STYLE current_demangling_style
114
108
  #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
115
- #define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)
116
- #define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)
117
- #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)
118
- #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)
119
- #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)
120
109
  #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
121
110
  #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
122
111
  #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
@@ -136,17 +125,8 @@ extern const struct demangler_engine
136
125
  extern char *
137
126
  cplus_demangle (const char *mangled, int options);
138
127
 
139
- extern int
140
- cplus_demangle_opname (const char *opname, char *result, int options);
141
-
142
- extern const char *
143
- cplus_mangle_opname (const char *opname, int options);
144
-
145
128
  /* Note: This sets global state. FIXME if you care about multi-threading. */
146
129
 
147
- extern void
148
- set_cplus_marker_for_demangling (int ch);
149
-
150
130
  extern enum demangling_styles
151
131
  cplus_demangle_set_style (enum demangling_styles style);
152
132
 
@@ -179,24 +159,11 @@ ada_demangle (const char *mangled, int options);
179
159
  extern char *
180
160
  dlang_demangle (const char *mangled, int options);
181
161
 
182
- /* Returns non-zero iff MANGLED is a rust mangled symbol. MANGLED must
183
- already have been demangled through cplus_demangle_v3. If this function
184
- returns non-zero then MANGLED can be demangled (in-place) using
185
- RUST_DEMANGLE_SYM. */
186
162
  extern int
187
- rust_is_mangled (const char *mangled);
188
-
189
- /* Demangles SYM (in-place) if RUST_IS_MANGLED returned non-zero for SYM.
190
- If RUST_IS_MANGLED returned zero for SYM then RUST_DEMANGLE_SYM might
191
- replace characters that cannot be demangled with '?' and might truncate
192
- SYM. After calling RUST_DEMANGLE_SYM SYM might be shorter, but never
193
- larger. */
194
- extern void
195
- rust_demangle_sym (char *sym);
196
-
197
- /* Demangles MANGLED if it was GNU_V3 and then RUST mangled, otherwise
198
- returns NULL. Uses CPLUS_DEMANGLE_V3, RUST_IS_MANGLED and
199
- RUST_DEMANGLE_SYM. Returns a new string that is owned by the caller. */
163
+ rust_demangle_callback (const char *mangled, int options,
164
+ demangle_callbackref callback, void *opaque);
165
+
166
+
200
167
  extern char *
201
168
  rust_demangle (const char *mangled, int options);
202
169
 
@@ -347,6 +314,8 @@ enum demangle_component_type
347
314
  /* C++11: An rvalue reference modifying a member function. The one
348
315
  subtree is the type which is being referenced. */
349
316
  DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS,
317
+ /* C++23: A member function with explict object parameter. */
318
+ DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION,
350
319
  /* A vendor qualifier. The left subtree is the type which is being
351
320
  qualified, and the right subtree is the name of the
352
321
  qualifier. */
@@ -392,6 +361,9 @@ enum demangle_component_type
392
361
  template argument, and the right subtree is either NULL or
393
362
  another TEMPLATE_ARGLIST node. */
394
363
  DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,
364
+ /* A template parameter object (C++20). The left subtree is the
365
+ corresponding template argument. */
366
+ DEMANGLE_COMPONENT_TPARM_OBJ,
395
367
  /* An initializer list. The left subtree is either an explicit type or
396
368
  NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST. */
397
369
  DEMANGLE_COMPONENT_INITIALIZER_LIST,
@@ -438,6 +410,9 @@ enum demangle_component_type
438
410
  number which involves neither modifying the mangled string nor
439
411
  allocating a new copy of the literal in memory. */
440
412
  DEMANGLE_COMPONENT_LITERAL_NEG,
413
+ /* A vendor's builtin expression. The left subtree holds the
414
+ expression's name, and the right subtree is a argument list. */
415
+ DEMANGLE_COMPONENT_VENDOR_EXPR,
441
416
  /* A libgcj compiled resource. The left subtree is the name of the
442
417
  resource. */
443
418
  DEMANGLE_COMPONENT_JAVA_RESOURCE,
@@ -475,8 +450,30 @@ enum demangle_component_type
475
450
  DEMANGLE_COMPONENT_TRANSACTION_SAFE,
476
451
  /* A cloned function. */
477
452
  DEMANGLE_COMPONENT_CLONE,
453
+ /* A member-like friend function. */
454
+ DEMANGLE_COMPONENT_FRIEND,
478
455
  DEMANGLE_COMPONENT_NOEXCEPT,
479
- DEMANGLE_COMPONENT_THROW_SPEC
456
+ DEMANGLE_COMPONENT_THROW_SPEC,
457
+
458
+ DEMANGLE_COMPONENT_STRUCTURED_BINDING,
459
+
460
+ DEMANGLE_COMPONENT_MODULE_NAME,
461
+ DEMANGLE_COMPONENT_MODULE_PARTITION,
462
+ DEMANGLE_COMPONENT_MODULE_ENTITY,
463
+ DEMANGLE_COMPONENT_MODULE_INIT,
464
+
465
+ DEMANGLE_COMPONENT_TEMPLATE_HEAD,
466
+ DEMANGLE_COMPONENT_TEMPLATE_TYPE_PARM,
467
+ DEMANGLE_COMPONENT_TEMPLATE_NON_TYPE_PARM,
468
+ DEMANGLE_COMPONENT_TEMPLATE_TEMPLATE_PARM,
469
+ DEMANGLE_COMPONENT_TEMPLATE_PACK_PARM,
470
+
471
+ DEMANGLE_COMPONENT_CONSTRAINTS,
472
+
473
+ /* A builtin type with argument. This holds the builtin type
474
+ information. */
475
+ DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE
476
+
480
477
  };
481
478
 
482
479
  /* Types which are only used internally. */
@@ -498,6 +495,7 @@ struct demangle_component
498
495
  Initialize to zero. Private to d_print_comp.
499
496
  All other fields are final after initialization. */
500
497
  int d_printing;
498
+ int d_counting;
501
499
 
502
500
  union
503
501
  {
@@ -562,6 +560,15 @@ struct demangle_component
562
560
  const struct demangle_builtin_type_info *type;
563
561
  } s_builtin;
564
562
 
563
+ /* For DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE. */
564
+ struct
565
+ {
566
+ /* Builtin type. */
567
+ const struct demangle_builtin_type_info *type;
568
+ short arg;
569
+ char suffix;
570
+ } s_extended_builtin;
571
+
565
572
  /* For DEMANGLE_COMPONENT_SUB_STD. */
566
573
  struct
567
574
  {
@@ -1,5 +1,5 @@
1
1
  /* Declare the environ system variable.
2
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
2
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
3
3
 
4
4
  This file is part of the libiberty library.
5
5
  Libiberty is free software; you can redistribute it and/or
@@ -2,4 +2,5 @@ require "mkmf"
2
2
 
3
3
  extension_name = "cxxfilt"
4
4
  dir_config(extension_name)
5
+ append_cflags("-DHAVE_STDLIB_H -DHAVE_STRING_H -DHAVE_ALLOCA_H -DHAVE_LIMITS_H")
5
6
  create_makefile extension_name
@@ -1,7 +1,7 @@
1
1
  /* Function declarations for libiberty.
2
2
 
3
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
4
-
3
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
4
+
5
5
  Note - certain prototypes declared in this header file are for
6
6
  functions whoes implementation copyright does not belong to the
7
7
  FSF. Those prototypes are present in this file for reference
@@ -23,7 +23,7 @@
23
23
  along with this program; if not, write to the Free Software
24
24
  Foundation, Inc., 51 Franklin Street - Fifth Floor,
25
25
  Boston, MA 02110-1301, USA.
26
-
26
+
27
27
  Written by Cygnus Support, 1994.
28
28
 
29
29
  The libiberty library provides a number of functions which are
@@ -108,7 +108,7 @@ extern int countargv (char * const *);
108
108
  #if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
109
109
  || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
110
110
  || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
111
- || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
111
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
112
112
  extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
113
113
  #else
114
114
  /* Do not allow basename to be used if there is no prototype seen. We
@@ -133,10 +133,26 @@ extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIB
133
133
 
134
134
  extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
135
135
 
136
+ /* A dirname () that is always compiled in. */
137
+
138
+ extern char *ldirname (const char *) ATTRIBUTE_NONNULL(1);
139
+
140
+ /* Same, but assumes DOS semantics regardless of host. */
141
+
142
+ extern char *dos_ldirname (const char *) ATTRIBUTE_NONNULL(1);
143
+
144
+ /* Same, but assumes Unix semantics regardless of host. */
145
+
146
+ extern char *unix_ldirname (const char *) ATTRIBUTE_NONNULL(1);
147
+
136
148
  /* A well-defined realpath () that is always compiled in. */
137
149
 
138
150
  extern char *lrealpath (const char *);
139
151
 
152
+ /* Return true when FD file descriptor exists. */
153
+
154
+ extern int is_valid_fd (int fd);
155
+
140
156
  /* Concatenate an arbitrary number of strings. You must pass NULL as
141
157
  the last argument of this function, to terminate the list of
142
158
  strings. Allocates memory using xmalloc. */
@@ -195,6 +211,20 @@ extern int fdmatch (int fd1, int fd2);
195
211
  extern int ffs(int);
196
212
  #endif
197
213
 
214
+ #if defined (HAVE_DECL_MKSTEMPS) && !HAVE_DECL_MKSTEMPS
215
+ extern int mkstemps(char *, int);
216
+ #endif
217
+
218
+ #if defined (HAVE_DECL_MKSTEMPS) && !HAVE_DECL_MKSTEMPS
219
+ extern int mkstemps(char *, int);
220
+ #endif
221
+
222
+ /* Make memrchr available on systems that do not have it. */
223
+ #if !defined (__GNU_LIBRARY__ ) && !defined (__linux__) && \
224
+ !defined (HAVE_MEMRCHR)
225
+ extern void *memrchr(const void *, int, size_t);
226
+ #endif
227
+
198
228
  /* Get the working directory. The result is cached, so don't call
199
229
  chdir() between calls to getpwd(). */
200
230
 
@@ -206,7 +236,7 @@ extern char * getpwd (void);
206
236
  #ifdef __MINGW32__
207
237
  /* Forward declaration to avoid #include <sys/time.h>. */
208
238
  struct timeval;
209
- extern int gettimeofday (struct timeval *, void *);
239
+ extern int gettimeofday (struct timeval *, void *);
210
240
  #endif
211
241
 
212
242
  /* Get the amount of time the process has run, in microseconds. */
@@ -310,30 +340,30 @@ extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN;
310
340
  message to stderr (using the name set by xmalloc_set_program_name,
311
341
  if any) and then call xexit. */
312
342
 
313
- extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
343
+ extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_1 ATTRIBUTE_WARN_UNUSED_RESULT;
314
344
 
315
345
  /* Reallocate memory without fail. This works like xmalloc. Note,
316
346
  realloc type functions are not suitable for attribute malloc since
317
347
  they may return the same address across multiple calls. */
318
348
 
319
- extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL;
349
+ extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_2 ATTRIBUTE_WARN_UNUSED_RESULT;
320
350
 
321
351
  /* Allocate memory without fail and set it to zero. This works like
322
352
  xmalloc. */
323
353
 
324
- extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
354
+ extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_1_2 ATTRIBUTE_WARN_UNUSED_RESULT;
325
355
 
326
356
  /* Copy a string into a memory buffer without fail. */
327
357
 
328
- extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
358
+ extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
329
359
 
330
360
  /* Copy at most N characters from string into a buffer without fail. */
331
361
 
332
- extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
362
+ extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
333
363
 
334
364
  /* Copy an existing memory buffer to a new memory buffer without fail. */
335
365
 
336
- extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
366
+ extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
337
367
 
338
368
  /* Physical memory routines. Return values are in BYTES. */
339
369
  extern double physmem_total (void);
@@ -456,7 +486,7 @@ extern struct pex_obj *pex_init (int flags, const char *pname,
456
486
  /* Capture stderr to a pipe. The output can be read by
457
487
  calling pex_read_err and reading from the returned
458
488
  FILE object. This flag may be specified only for
459
- the last program in a pipeline.
489
+ the last program in a pipeline.
460
490
 
461
491
  This flag is supported only on Unix and Windows. */
462
492
  #define PEX_STDERR_TO_PIPE 0x40
@@ -558,7 +588,7 @@ extern FILE *pex_input_file (struct pex_obj *obj, int flags,
558
588
  extern FILE *pex_input_pipe (struct pex_obj *obj, int binary);
559
589
 
560
590
  /* Read the standard output of the last program to be executed.
561
- pex_run can not be called after this. BINARY should be non-zero if
591
+ pex_run cannot be called after this. BINARY should be non-zero if
562
592
  the file should be opened in binary mode; this is ignored on Unix.
563
593
  Returns NULL on error. Don't call fclose on the returned FILE; it
564
594
  will be closed by pex_free. */
@@ -566,7 +596,7 @@ extern FILE *pex_input_pipe (struct pex_obj *obj, int binary);
566
596
  extern FILE *pex_read_output (struct pex_obj *, int binary);
567
597
 
568
598
  /* Read the standard error of the last program to be executed.
569
- pex_run can not be called after this. BINARY should be non-zero if
599
+ pex_run cannot be called after this. BINARY should be non-zero if
570
600
  the file should be opened in binary mode; this is ignored on Unix.
571
601
  Returns NULL on error. Don't call fclose on the returned FILE; it
572
602
  will be closed by pex_free. */
@@ -637,6 +667,13 @@ extern int pexecute (const char *, char * const *, const char *,
637
667
 
638
668
  extern int pwait (int, int *, int);
639
669
 
670
+ /* Like bsearch, but takes and passes on an argument like qsort_r. */
671
+
672
+ extern void *bsearch_r (const void *, const void *,
673
+ size_t, size_t,
674
+ int (*)(const void *, const void *, void *),
675
+ void *);
676
+
640
677
  #if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF
641
678
  /* Like sprintf but provides a pointer to malloc'd storage, which must
642
679
  be freed by the caller. */
@@ -649,7 +686,7 @@ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
649
686
 
650
687
  extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1;
651
688
 
652
- #if !HAVE_DECL_VASPRINTF
689
+ #if defined(HAVE_DECL_VASPRINTF) && !HAVE_DECL_VASPRINTF
653
690
  /* Like vsprintf but provides a pointer to malloc'd storage, which
654
691
  must be freed by the caller. */
655
692
 
@@ -702,11 +739,6 @@ extern unsigned long long int strtoull (const char *nptr,
702
739
  char **endptr, int base);
703
740
  #endif
704
741
 
705
- #if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
706
- /* Compare version strings. */
707
- extern int strverscmp (const char *, const char *);
708
- #endif
709
-
710
742
  /* Set the title of a process */
711
743
  extern void setproctitle (const char *name, ...);
712
744