X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fprdbg.c;h=1b376f485fecf04303d39b6240c1475e65e8dfa9;hb=d2d1ea20aef6ed97232280b5e15a52b8d7dc7b7d;hp=92c608733cd6d8d0f14ccd9c1d08f883c8d45b1f;hpb=98a4fc78f9dab76b5ada3551a7bef36db8a3ed05;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/prdbg.c b/binutils/prdbg.c index 92c608733c..1b376f485f 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -1,5 +1,5 @@ /* prdbg.c -- Print out generic debugging information. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . Tags style generation written by Salvador E. Tropea . @@ -286,6 +286,8 @@ static const struct debug_write_fns tg_fns = pr_end_function, /* Same, does nothing. */ tg_lineno }; + +static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; /* Print out the generic debugging information recorded in dhandle. */ @@ -581,7 +583,7 @@ static bfd_boolean pr_int_type (void *p, unsigned int size, bfd_boolean unsignedp) { struct pr_handle *info = (struct pr_handle *) p; - char ab[10]; + char ab[40]; sprintf (ab, "%sint%d", unsignedp ? "u" : "", size * 8); return push_type (info, ab); @@ -593,7 +595,7 @@ static bfd_boolean pr_float_type (void *p, unsigned int size) { struct pr_handle *info = (struct pr_handle *) p; - char ab[10]; + char ab[40]; if (size == 4) return push_type (info, "float"); @@ -623,7 +625,7 @@ static bfd_boolean pr_bool_type (void *p, unsigned int size) { struct pr_handle *info = (struct pr_handle *) p; - char ab[10]; + char ab[40]; sprintf (ab, "bool%d", size * 8); @@ -1622,7 +1624,7 @@ pr_tag_type (void *p, const char *name, unsigned int id, t = "union class "; break; default: - abort (); + /* PR 25625: Corrupt input can trigger this case. */ return FALSE; } @@ -1928,14 +1930,14 @@ find_address_in_section (bfd *abfd, asection *section, void *data) if (found) return; - if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + if ((bfd_section_flags (section) & SEC_ALLOC) == 0) return; - vma = bfd_get_section_vma (abfd, section); + vma = bfd_section_vma (section); if (pc < vma) return; - size = bfd_get_section_size (section); + size = bfd_section_size (section); if (pc >= vma + size) return; @@ -2115,6 +2117,7 @@ tg_start_class_type (void *p, const char *tag, unsigned int id, struct pr_handle *info = (struct pr_handle *) p; char *tv = NULL; const char *name; + char idbuf[20]; info->indent += 2; @@ -2129,8 +2132,6 @@ tg_start_class_type (void *p, const char *tag, unsigned int id, name = tag; else { - char idbuf[20]; - sprintf (idbuf, "%%anon%u", id); name = idbuf; } @@ -2600,7 +2601,7 @@ tg_variable (void *p, const char *name, enum debug_var_kind kind, dname = NULL; if (info->demangler) - dname = info->demangler (info->abfd, name, DMGL_ANSI | DMGL_PARAMS); + dname = info->demangler (info->abfd, name, demangle_flags); from_class = NULL; if (dname != NULL) @@ -2661,7 +2662,7 @@ tg_start_function (void *p, const char *name, bfd_boolean global) dname = NULL; if (info->demangler) - dname = info->demangler (info->abfd, name, DMGL_ANSI | DMGL_PARAMS); + dname = info->demangler (info->abfd, name, demangle_flags); if (! substitute_type (info, dname ? dname : name)) return FALSE;