Print this page
6375 Add native name demangling support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
@@ -20,14 +20,14 @@
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018, Joyent, Inc.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* All routines in this file are for processing new-style, *versioned*
* mon.out format. Together with rdelf.c, lookup.c and profv.h, these
* form the complete set of files to profile new-style mon.out files.
*/
@@ -72,11 +72,12 @@
nbp = namebuf;
nbe = namebuf + namebuf_sz;
for (i = 0; i < total_funcs; i++) {
- if ((p = conv_demangle_name(profsym[i].name)) == NULL)
+ p = conv_demangle_name(profsym[i].name);
+ if (p == profsym[i].name)
continue;
namelen = strlen(p);
if ((nbp + namelen + 1) > nbe) {
namebuf_sz += BUCKET_SZ;
@@ -95,10 +96,11 @@
(void) strcpy(nbp, p);
profsym[i].demangled_name = nbp;
nbp += namelen + 1;
cur_len += namelen + 1;
+ free((void *)p);
}
}
int
cmp_by_time(const void *arg1, const void *arg2)