Print this page
Rich's feedback
*** 21,44 ****
*/
/*
* Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
! * Copyright 2017 Jason King
*/
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_demangle.h>
#include <mdb/mdb_err.h>
#include <mdb/mdb.h>
- #include <demangle.h>
#include <strings.h>
#include <unistd.h>
#include <dlfcn.h>
#include <link.h>
- #include <sysdemangle.h>
static void *
mdb_dem_alloc(size_t len)
{
return (mdb_alloc(len, UM_SLEEP));
--- 21,42 ----
*/
/*
* Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
! * Copyright 2018 Jason King
*/
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_demangle.h>
#include <mdb/mdb_err.h>
#include <mdb/mdb.h>
#include <strings.h>
#include <unistd.h>
#include <dlfcn.h>
#include <link.h>
static void *
mdb_dem_alloc(size_t len)
{
return (mdb_alloc(len, UM_SLEEP));
*** 206,217 ****
prefix++; /* the ` is part of the prefix */
prefixlen = prefix - name;
}
res = sysdemangle(name + prefixlen, dmp->dm_lang, &mdb_dem_demops);
! if (res == NULL && errno != EINVAL)
mdb_warn("Error while demangling");
reslen = (res != NULL) ? strlen(res) : 0;
reslen += prefixlen;
reslen += 1;
--- 204,218 ----
prefix++; /* the ` is part of the prefix */
prefixlen = prefix - name;
}
res = sysdemangle(name + prefixlen, dmp->dm_lang, &mdb_dem_demops);
! if (res == NULL) {
! if (errno != EINVAL)
mdb_warn("Error while demangling");
+ return (-1);
+ }
reslen = (res != NULL) ? strlen(res) : 0;
reslen += prefixlen;
reslen += 1;
*** 227,238 ****
dmp->dm_len = reslen;
}
if (prefixlen > 0)
(void) strlcpy(dmp->dm_buf, name, prefixlen);
! if (res != NULL)
(void) strlcat(dmp->dm_buf, res, dmp->dm_len);
/*
* Save the position of the demangled string for mdb_dem_filter()
*/
dmp->dm_dem = dmp->dm_buf + prefixlen;
--- 228,242 ----
dmp->dm_len = reslen;
}
if (prefixlen > 0)
(void) strlcpy(dmp->dm_buf, name, prefixlen);
!
! if (res != NULL) {
(void) strlcat(dmp->dm_buf, res, dmp->dm_len);
+ mdb_dem_free(res, strlen(res) + 1);
+ }
/*
* Save the position of the demangled string for mdb_dem_filter()
*/
dmp->dm_dem = dmp->dm_buf + prefixlen;