Print this page
libconv

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/liblddbg/common/util.c
          +++ new/usr/src/cmd/sgs/liblddbg/common/util.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + *
       26 + * Copyright 2018 Jason King
  25   27   */
  26   28  
  27   29  #include        "msg.h"
  28   30  #include        "_debug.h"
  29   31  #include        "libld.h"
  30   32  
  31   33  /*
  32   34   * If any run-time linker debugging is being carried out always indicate the
  33   35   * fact and specify the point at which we transfer control to the main program.
  34   36   */
↓ open down ↓ 300 lines elided ↑ open up ↑
 335  337          if (flag == DBG_NL_STD)
 336  338                  dbg_desc->d_extra |= DBG_E_STDNL;
 337  339  }
 338  340  
 339  341  /*
 340  342   * Define name demanglers.
 341  343   */
 342  344  const char *
 343  345  Dbg_demangle_name(const char *name)
 344  346  {
      347 +        static char *buf = NULL;
      348 +
 345  349          if (DBG_NOTCLASS(DBG_C_DEMANGLE))
 346  350                  return (name);
 347  351  
 348      -        return (conv_demangle_name(name));
      352 +        free(buf);
      353 +        buf = (char *)conv_demangle_name(name);
      354 +        if (buf == name) {
      355 +                buf = NULL;
      356 +                return (name);
      357 +        }
      358 +
      359 +        return (buf);
 349  360  }
 350  361  
 351  362  const char *
 352  363  Elf_demangle_name(const char *name)
 353  364  {
 354      -        if (DBG_ISDEMANGLE())
 355      -                return (conv_demangle_name(name));
 356      -        return (name);
      365 +        static char *buf = NULL;
      366 +
      367 +        if (!DBG_ISDEMANGLE())
      368 +                return (name);
      369 +
      370 +        free(buf);
      371 +        buf = (char *)conv_demangle_name(name);
      372 +        if (buf == name) {
      373 +                buf = NULL;
      374 +                return (name);
      375 +        }
      376 +
      377 +        return (buf);
 357  378  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX