Age | Commit message (Collapse) | Author | Files | Lines |
|
These comment typos were found in the valgrind fork of libiberty
demangle code.
libiberty/ChangeLog:
* cplus-dem.c: Change preceeded to preceded.
include/ChangeLog:
* safe-ctype.h: Change accidently to accidentally.
|
|
Investigating GDB PR d/31580 showed that the libiberty demangler
doesn't automatically demangle D mangled names. However, I think it
should -- like C++ and Rust (new-style), D mangled names are readily
distinguished by the leading "_D", and so the likelihood of confusion
is low. The other non-"auto" cases in this code are Ada (where the
encoded form could more easily be confused by ordinary programs) and
Java (which is long gone, but which also shared the C++ mangling and
thus was just an output style preference).
This patch also fixed another GDB bug, though of course that part
won't apply to the GCC repository.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31580
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30276
libiberty
* cplus-dem.c (cplus_demangle): Try the D demangler with
"auto" format.
* testsuite/d-demangle-expected: Add --format=auto test.
|
|
|
|
|
|
|
|
|
|
From-SVN: r279813
|
|
* demangle.h (rust_demangle_callback): Add.
* cplus-dem.c (cplus_demangle): Use rust_demangle directly.
(rust_demangle): Remove.
* rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash.
(parse_lower_hex_nibble): Rename to decode_lower_hex_nibble.
(parse_legacy_escape): Rename to decode_legacy_escape.
(rust_is_mangled): Remove.
(struct rust_demangler): Add.
(peek): Add.
(next): Add.
(struct rust_mangled_ident): Add.
(parse_ident): Add.
(rust_demangle_sym): Remove.
(print_str): Add.
(PRINT): Add.
(print_ident): Add.
(rust_demangle_callback): Add.
(struct str_buf): Add.
(str_buf_reserve): Add.
(str_buf_append): Add.
(str_buf_demangle_callback): Add.
(rust_demangle): Add.
* rust-demangle.h: Remove.
From-SVN: r278358
|
|
include/
* demangle.h (rust_is_mangled): Move to libiberty/rust-demangle.h.
(rust_demangle_sym): Move to libiberty/rust-demangle.h.
libiberty/
* cplus-dem.c: Include rust-demangle.h.
* rust-demangle.c: Include rust-demangle.h.
* rust-demangle.h: New file.
From-SVN: r273573
|
|
From-SVN: r267494
|
|
libiberty/
* cplus-dem.c: Remove cplus_mangle_opname, cplus_demangle_opname,
internal_cplus_demangle, and all subroutines.
(libiberty_demanglers): Remove entries for ancient GNU (pre-3.0),
Lucid, ARM, HP, and EDG demangling styles.
(cplus_demangle): Remove 'work' variable. Don't call
internal_cplus_demangle.
include/
* demangle.h: Remove support for ancient GNU (pre-3.0), Lucid,
ARM, HP, and EDG demangling styles.
From-SVN: r267363
|
|
by default, but can be disabled via a new demangling option.
include * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
(DEMANGLE_RECURSION_LIMIT): Define
PR 87681
PR 87675
PR 87636
PR 87350
PR 87335
libiberty * cp-demangle.h (struct d_info): Add recursion_level field.
* cp-demangle.c (d_function_type): Add recursion counter.
If the recursion limit is reached and the check is not disabled,
then return with a failure result.
(cplus_demangle_init_info): Initialise the recursion_level field.
(d_demangle_callback): If the recursion limit is enabled, check
for a mangled string that is so long that there is not enough
stack space for the local arrays.
* cplus-dem.c (struct work): Add recursion_level field.
(squangle_mop_up): Set the numb and numk fields to zero.
(work_stuff_copy_to_from): Handle the case where a btypevec or
ktypevec field is NULL.
(demangle_nested_args): Add recursion counter. If
the recursion limit is not disabled and reached, return with a
failure result.
From-SVN: r266886
|
|
2018-07-30 Tom Tromey <tom@tromey.com>
* cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0.
From-SVN: r263069
|
|
From-SVN: r256169
|
|
PR demangler/80513
* cp-demangle.c (d_number): Check for overflow.
* cplus-dem.c (consume_count): Fix overflow check.
(gnu_special): Check for underscore after thunk delta.
* testsuite/demangle-expected: Add tests for overflows and invalid
characters in thunks.
From-SVN: r247300
|
|
From-SVN: r244052
|
|
Adds Rust symbol demangler. Rust mangles symbols using GNU_V3 style,
adding a hash and various special character subtitutions. This adds
a new rust style to cplus_demangle and adds 3 helper functions
rust_demangle, rust_demangle_sym and rust_is_mangled.
rust-demangle.c was written by David. Mark did the code formatting to
GNU style and integration into the gcc/libiberty build system and
testsuite.
include/ChangeLog:
2016-11-03 David Tolnay <dtolnay@gmail.com>
Mark Wielaard <mark@klomp.org>
* demangle.h (DMGL_RUST): New macro.
(DMGL_STYLE_MASK): Add DMGL_RUST.
(demangling_styles): Add dlang_rust.
(RUST_DEMANGLING_STYLE_STRING): New macro.
(RUST_DEMANGLING): New macro.
(rust_demangle): New prototype.
(rust_is_mangled): Likewise.
(rust_demangle_sym): Likewise.
libiberty/ChangeLog:
2016-11-03 David Tolnay <dtolnay@gmail.com>
Mark Wielaard <mark@klomp.org>
* Makefile.in (CFILES): Add rust-demangle.c.
(REQUIRED_OFILES): Add rust-demangle.o.
* cplus-dem.c (libiberty_demanglers): Add rust_demangling case.
(cplus_demangle): Handle RUST_DEMANGLING.
(rust_demangle): New function.
* rust-demangle.c: New file.
* testsuite/Makefile.in (really-check): Add check-rust-demangle.
(check-rust-demangle): New rule.
* testsuite/rust-demangle-expected: New file.
Co-Authored-By: Mark Wielaard <mark@klomp.org>
From-SVN: r242524
|
|
In various situations the cplus_demangle () function could read past the
end of input causing crashes. Add checks in various places to not advance
the demangle string location and fail early when end of string is reached.
Add various examples of input strings to the testsuite that would crash
test-demangle before the fixes.
Found by using the American Fuzzy Lop (afl) fuzzer.
libiberty/ChangeLog:
* cplus-dem.c (demangle_signature): After 'H', template function,
no success and don't advance position if end of string reached.
(demangle_template): After 'z', template name, return zero on
premature end of string.
(gnu_special): Guard strchr against searching for zero characters.
(do_type): If member, only advance mangled string when 'F' found.
* testsuite/demangle-expected: Add examples of strings that could
crash the demangler by reading past end of input.
From-SVN: r242450
|
|
Adjust some comments, add some explicit fall through comments or explicit
returns where necessary to not get implicit-fallthrough warnings.
All fall throughs were deliberate. In one case I added an explicit return
false for clarity instead of falling through a default case (that also
would return false).
libiberty/ChangeLog:
* cplus-dem.c (demangle_signature): Move fall through comment.
(demangle_fund_type): Add fall through comment between 'G' and 'I'.
* hashtab.c (iterative_hash): Add fall through comments.
* regex.c (regex_compile): Add Fall through comment after '+'/'?'.
(byte_re_match_2_internal): Add Fall through comment after jump_n.
Change "Note fall through" to "Fall through".
(common_op_match_null_string_p): Return false after set_number_at
instead of fall through.
From-SVN: r241864
|
|
When a symbol cannot be demangled in ada_demangle a new demangled VEC
will be allocated without deleting the demangled VEC already in use.
Running testsuite/test-demangle under valgrind will show the leak for
this entry in testsuite/demangle-expected:
# Elaborated flag (not demangled)
--format=gnat
x_E
<x_E>
11 bytes in 1 blocks are definitely lost in loss record 1 of 1
at 0x4C27BE3: malloc (vg_replace_malloc.c:299)
by 0x413FE7: xmalloc (xmalloc.c:148)
by 0x4025EC: ada_demangle (cplus-dem.c:930)
by 0x402C59: cplus_demangle (cplus-dem.c:892)
by 0x400FEC: main (test-demangle.c:317)
libiberty/ChangeLog:
* cplus-dem.c (ada_demangle): Initialize demangled to NULL and
XDELETEVEC demangled when unknown.
From-SVN: r241760
|
|
2016-08-04 Marcel Böhme <boehme.marcel@gmail.com>
PR c++/71696
* cplus-dem.c: Prevent infinite recursion when there is a cycle
in the referencing of remembered mangled types.
(work_stuff): New stack to keep track of the remembered mangled
types that are currently being processed.
(push_processed_type): New method to push currently processed
remembered type onto the stack.
(pop_processed_type): New method to pop currently processed
remembered type from the stack.
(work_stuff_copy_to_from): Copy values of new variables.
(delete_non_B_K_work_stuff): Free stack memory.
(demangle_args): Push/Pop currently processed remembered type.
(do_type): Do not demangle a cyclic reference and push/pop
referenced remembered type.
From-SVN: r239143
|
|
PR c++/70926
* cplus-dem.c: Handle large values and overflow when demangling
length variables.
(demangle_template_value_parm): Read only until end of mangled string.
(do_hpacc_template_literal): Likewise.
(do_type): Handle overflow when demangling array indices.
From-SVN: r238313
|
|
* cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference
constant.
(demangle_template_value_parm): Handle tk_rvalue_reference
type kind.
(do_type): Support 'O' type id (rvalue references).
* testsuite/demangle-expected: Add tests.
From-SVN: r236434
|
|
PR c++/69687
* cplus-dem.c: Include <limits.h> if available.
(INT_MAX): Define if necessary.
(remember_type, remember_Ktype, register_Btype, string_need):
Abort if we detect cases where we the size of the allocation would
overflow.
From-SVN: r234829
|
|
PR c++/70498
* cplus-dem.c (gnu_special): Handle case where consume_count returns
-1.
From-SVN: r234828
|
|
* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing
btypevec/ktypevec.
* testsuite/demangle-expected: Add coverage tests.
From-SVN: r234645
|
|
include/:
* demangle.h (DMGL_DLANG): New macro.
(DMGL_STYLE_MASK): Add DMGL_DLANG.
(demangling_styles): Add dlang_demangling.
(DLANG_DEMANGLING_STYLE_STRING): New macro.
(DLANG_DEMANGLING): New macro.
(dlang_demangle): New prototype.
libiberty/:
* Makefile.in (CFILES): Add d-demangle.c.
(REQUIRED_OFILES): Add d-demangle.o.
* cplus-dem.c (libiberty_demanglers): Add dlang_demangling case.
(cplus_demangle): Likewise.
* d-demangle.c: New file.
* testsuite/Makefile.in (really-check): Add check-d-demangle.
* testsuite/d-demangle-expected: New file.
From-SVN: r215530
|
|
A call to demangle_template might allocate storage within a temporary
string even if the call to demangle_template eventually returns
failure.
This will never cause the demangler to crash, but does leak memory, as
a result I've not added any tests for this.
Calling string_delete is safe, even if nothing is allocated into the
string, the string is initialised with string_init, so we know the
internal pointers are NULL.
libiberty/ChangeLog
* cplus-dem.c (do_type): Call string_delete even if the call to
demangle_template fails.
From-SVN: r211449
|
|
possible previous call to gnu_special.
libiberty/
2014-05-14 Andrew Burgess <aburgess@broadcom.com>
* cplus-dmem.c (internal_cplus_demangle): Free any resources
allocated by possible previous call to gnu_special.
(squangle_mop_up): Reset pointers to NULL after calling free.
* testsuite/demangle-expected: New test case.
From-SVN: r210425
|
|
Change "if (E) free (E);" to "free (E);" everywhere except in the
libgo/, intl/, zlib/ and classpath/ directories.
Also transform equivalent variants like
"if (E != NULL) free (E);" and allow an extra cast on the
argument to free. Otherwise, the tested and freed "E"
expressions must be identical, modulo white space.
From-SVN: r172785
|
|
From-SVN: r168438
|
|
2010-09-22 Tristan Gingold <gingold@adacore.com>
* cplus-dem.c (ada_demangle): Add comments.
Handle stream and controlled type operations.
Decoding of some uppercase letters moved before separators.
* testsuite/demangle-expected: Add tests.
From-SVN: r164518
|
|
include/
2010-01-11 Tristan Gingold <gingold@adacore.com>
* demangle.h (ada_demangle): Add prototype.
libiberty/
2010-01-11 Tristan Gingold <gingold@adacore.com>
* cplus-dem.c (ada_demangle): Remove prototype.
(grow_vect): Removed.
(ada_demangle): Rewritten.
(cplus_demangle): Fix indentation.
* testsuite/demangle-expected: Add tests for Ada.
From-SVN: r155804
|
|
2009-09-23 Matthew Gingell <gingell@adacore.com>
* cplus-dem.c (ada_demangle): Ensure demangled is freed.
From-SVN: r152060
|
|
2008-03-12 Seongbae Park <seongbae.park@gmail.com>
* cplus-dem.c (malloc, realloc): Use void * instead of char *
as return type.
From-SVN: r133181
|
|
a name was correctly demangled.
2008-01-23 Thiago Jung Bauermann <bauerman@br.ibm.com>
* cplus-dem.c (demangle_function_name): Changed to return value
indicating if a name was correctly demangled.
(iterate_demangle_function): Use demangle_function_name return
value.
From-SVN: r131754
|
|
* cplus-dem.c (demangle_fund_type): Ensure buf is large enough to
hold "int%u_t".
From-SVN: r113728
|
|
include/
2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
* libiberty.h (ACONCAT): Properly cast value of alloca().
* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
__cplusplus.
libiberty/
2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
* configure.ac: Check declarations for calloc(), getenv(),
malloc(), realloc() and sbrk().
* config.in: Regenerate.
* configure: Likewise.
* alloca.c (C_alloca): Change "new" to "new_storage". Use XNEWVEC
instead of xmalloc.
* choose-temp.c (choose_temp_base): Use XNEWVEC instea od xmalloc.
* concat.c (liiberty_concat_ptr): Surround definition with an
extern "C" block, if __cplusplus.
(concat): Use XNEWVEC instead of xmalloc.
(reconcat): Likewise.
* cp-demangle.c (struct d_print_template): Rename member
"template" to "template_decl". Adjust use throughout the file.
(d_print_resize): Properly cast return value of realloc().
(cplus_demangle_print): Same for malloc().
(d_demangle): Likewise.
* cp-demint.c (cplus_demangle_fill_builtin_type): Rename parameter
"typename" to "type_name".
* cplus-dem.c (grow_vect): Use XRESIZEVEC instead of xrealloc().
(work_stuff_copy_to_from): Use XNEWVEC insteand of xmalloc().
(demangle_template_value_parm): Likewise.
(demangle_template): Likewise.
(recursively_demangle): Likewise.
(do_hpacc_template_literal): Likewise.
(do_arg): Likewise.
(remember_type): Likewise.
(remember_Ktype): Likewise.
(register_Btype): Likewise.
(string_need): Use XRESIZEVEC instead of xrealloc().
* dyn-string.c (dyn_string_init): Use XNEWVEC.
(dyn_string_new): Use XNEW.
(dyn_string_resize): Use XRESIZEVEC.
* fnmatch.c (fnmatch): Rename local variable "not" to "negate".
* getopt.c (getenv): Declare only if !__cplusplus and !getenv.
Otherwise include <stdlib.h>.
(exchange): Cast return value of malloc().
* hashtab.c (htab_size): Define as both macro and non-inline
function.
(htab_elements): Likewise.
* getpwd.c (getpwd): Use XNEWVEC.
(htab_create_alloc_ex): Use C90 prototype-style.
* lrealpath.c (lrealpath): Appropriately cast return value of
malloc().
* make-relative-prefix.c (save_string): Likewise.
* make-temp-file.c (try_dir): Rename from "try". Adjust use in
the file.
(choose_tmpdir): Use XNEWVEC.
* mkstemps.c (mkstemps): Rename parameter "template" to "pattern".
* pex-common.c (pex_init_common): Use XNEW.
(pex_add_remove): Use XRESIZEVEC.
(pex_run): Likewise.
(pex_get_status_and_time): Likewise.
* pex-djgpp.c (pex_djgpp_exec_child): Likewise.
* pex-msdos.c (pex_init): Use XNEW.
(pex_msdos_exec_child): Likewise.
(pex_msdos_exec_child): Use XRESIZEVEC.
* pex-unix.c (pex_wait): Use XNEW.
* pex-win32.c (fix_argv): Use XNEWVEC.
* pexecute.c (pwait): Likewise.
* setenv.c (setenv): Properly cast return value of malloc().
* sigsetmask.c (sigsetmask): Rename local variables "old" and
"new" to "old_sig" and "new_sig".
* sort.c (main): Use XNEWVEC.
* spaces.c (spaces): Cast return value of malloc().
* strndup.c (strndup): Likewise.
* ternary.c (ternary_insert): Use XNEW.
* xmalloc.c (malloc, realloc, calloc, sbrk): Surround declaration
with an extern "C" block if __cplusplus.
* xstrdup.c (xstrdup): Cast return value of memcpy().
* xstrerror.c (strerror): Enclose declaration in an extern "C"
block if __cplusplus.
* xstrndup.c (xstrndup): Use XNEW. Cast return value of memcpy().
From-SVN: r100115
|
|
From-SVN: r99519
|
|
* cplus-dem.c (set_cplus_marker_for_demangling, consume_count,
consume_count_with_underscores, code_for_qualifier,
qualifier_string, demangle_qualifier, cplus_demangle_opname,
cplus_mangle_opname, cplus_demangle_set_style,
cplus_demangle_name_to_style, cplus_demangle, grow_vect,
ada_demangle, internal_cplus_demangle, squangle_mop_up,
work_stuff_copy_to_from, delete_non_B_K_work_stuff,
delete_work_stuff, mop_up, demangle_signature,
demangle_method_args, demangle_template_template_parm,
demangle_expression, demangle_integral_value,
demangle_real_value, demangle_template_value_parm,
demangle_template, arm_pt, demangle_arm_hp_template,
demangle_class_name, demangle_class,
iterate_demangle_function,
demangle_prefix, gnu_special, recursively_demangle,
arm_special,
demangle_qualified, get_count, do_type, demangle_fund_type,
do_hpacc_template_const_value, do_hpacc_template_literal,
snarf_numeric_literal, do_arg, remember_type, remember_Ktype,
register_Btype, remember_Btype, forget_B_and_K_types,
forget_types, demangle_args, demangle_nested_args,
demangle_function_name, string_need, string_delete,
string_init,
string_clear, string_empty, string_append, string_appends,
string_appendn, string_prepend, string_prepends,
string_prependn,
string_append_template_idx): Use ISO C prootype style.
* cp-demint.c (cplus_demangle_fill_component,
cplus_demangle_fill_builtin_type,
cplus_demangle_fill_operator,
cplus_demangle_v3_components): Likewise.
From-SVN: r97109
|
|
PR other/18623
* cp-demangle.c (d_call_offset): Remove useless local variables
offset and virtual_offset.
* cplus-dem.c (ada_demangle): Remove useless local variable
at_start_name.
(demangle_template): Remove useless local variable start.
From-SVN: r91133
|
|
* cp-demangle.c (d_encoding): When DMGL_PARAMS is not set, strip
CV-qualifiers from D_COMP_LOCAL_NAME right subtree.
* cplus-dem.c (demangle_arm_hp_template): Set DMGL_PARAMS when
demangling template parameters.
* testsuite/test-demangle.c (fail): New static function.
(main): Support new options in input file: --no-params,
--is-v3-ctor, and --is-v3-dtor.
* testsuite/demangle-expected: Add --no-params to most tests, and
add the correct result when parameters are not demangled. Add
some simple tests for V3 constructor/destructor recognition.
From-SVN: r75336
|
|
* cplus-dem.c (demangle_template): Register a new Btype only
when needed.
* testsuite/demangle-expected: Add a new test.
From-SVN: r72729
|
|
2002-01-10 in order to also make negative...
* cplus-dem.c (demangle_integral_value): Correction to reflect
patch of 2002-01-10 in order to also make negative multi-digits
without leading underscore work.
From-SVN: r64179
|
|
From-SVN: r63760
|
|
From-SVN: r63182
|
|
Fix PR c++/7612.
* cplus-dem.c (demangle_signature): Call string_delete.
Remove extra string_init.
(demangle_arm_hp_template): Call string_delete instead of
string_clear. Add missing string_delete call.
(demangle_qualified): Add missing string_delete call.
(do_type): Remove unused variable btype. Add missing string_delete
call. Call string_delete instead of string_clear.
(demangle_fund_type): Move variable btype inside of the switch
statement. Add missing string_delete call.
(do_arg): Call string_delete instead of string_clear. Remove extra
string_init.
(demangle_nested_args): Free work->previous_argument.
From-SVN: r62852
|
|
strict-aliasing warning.
* libiberty/cplus-dem.c (ada_demangle): Get rid of unneeded
variable and of strict-aliasing warning.
(grow_vect): Use char as first parameter.
From-SVN: r57866
|
|
* cp-demangle.c (demangling_new): Cast 0 to enum.
(demangle_char): Cast return of strdup to char *.
(is_gnu_v3_mangled_ctor): Cast 0 to enum.
(is_gnu_v3_mangled_dtor): Likewise.
* cplus-dem.c (grow_vect): Cast return of xrealloc to void *.
(work_stuff_copy_to_from): Cast return of xmalloc to char **.
* fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t.
* md5.c (md5_process_bytes): Cast results back to const void *.
(md5_process_block): Add cast to const md5_uint32 *.
* regex.c (re_compile_fastmap): Cast enum to UCHAR_T.
* safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to
unsigned short.
* splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc
to void *.
* vasprintf.c (int_vasprintf): Cast return of malloc to char *.
From-SVN: r57330
|
|
gcc:
* Makefile.in: Remove all references to s-under and underscore.c.
* collect2.c, tlink.c: Change all uses of prepends_underscore
to look directly at USER_LABEL_PREFIX.
gcc/cp:
* Make-lang.in: Build cp/cxxfilt.o from $(srcdir)/cp/cxxfilt.c,
and c++filt from cxxfilt.o + version.o + $(LIBDEPS).
* cxxfilt.c: New file: split from libiberty/cplus-dem.c, with
minor adjustments (use version_string, eliminate yet another
duplicate of xmalloc)
libiberty:
* cplus-dem.c: Code code under #ifdef MAIN moved to gcc/cp/cxxfilt.c.
* testsuite/Makefile.in: Adjust for test-demangle.
* testsuite/regress-demangle: Deleted.
* testsuite/test-demangle.c: New file.
* testsuite/demangle-expected: Change \$ to $ throughout, now that
this file is not being read by a shell script.
From-SVN: r57037
|