461 if (strlen(sym_name))
462 (void) printf("%-20s", sym_name);
463 else {
464 (void) printf("%-20d", sym.st_name);
465 }
466 (void) printf("%-20s",
467 conv_reloc_type(p_ehdr->e_machine,
468 type, DUMP_CONVFMT, &inv_buf));
469 }
470 (void) printf("\n");
471 ndx++;
472 }
473 }
474
475 /* demangle C++ names */
476 static char *
477 demangled_name(char *s)
478 {
479 static char *buf = NULL;
480 size_t buflen = 0;
481 const char *dn;
482 size_t len;
483
484 dn = conv_demangle_name(s);
485
486 /*
487 * If not demangled, just return the symbol name
488 */
489 if (dn == s)
490 return (s);
491
492 len = strlen(dn) + strlen(s) + 4;
493
494 if (buflen < len) {
495 free(buf);
496 if ((buf = malloc(len)) == NULL)
497 return (s);
498 buflen = len;
499 }
500
501 /*
502 * Demangled. Format it
503 */
504 (void) snprintf(buf, buflen, "%s\t[%s]", dn, s);
|
461 if (strlen(sym_name))
462 (void) printf("%-20s", sym_name);
463 else {
464 (void) printf("%-20d", sym.st_name);
465 }
466 (void) printf("%-20s",
467 conv_reloc_type(p_ehdr->e_machine,
468 type, DUMP_CONVFMT, &inv_buf));
469 }
470 (void) printf("\n");
471 ndx++;
472 }
473 }
474
475 /* demangle C++ names */
476 static char *
477 demangled_name(char *s)
478 {
479 static char *buf = NULL;
480 size_t buflen = 0;
481 char *dn;
482 size_t len;
483
484 dn = (char *)conv_demangle_name(s);
485
486 /*
487 * If not demangled, just return the symbol name
488 */
489 if (dn == s)
490 return (s);
491
492 len = strlen(dn) + strlen(s) + 4;
493
494 if (buflen < len) {
495 free(buf);
496 if ((buf = malloc(len)) == NULL)
497 return (s);
498 buflen = len;
499 }
500
501 /*
502 * Demangled. Format it
503 */
504 (void) snprintf(buf, buflen, "%s\t[%s]", dn, s);
|