summaryrefslogtreecommitdiff
path: root/usr/src/tools/ctf/dwarf/common/dwarf_funcs.c
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-05-22 03:13:22 +0100
committerRichard Lowe <richlowe@richlowe.net>2011-05-22 03:13:22 +0100
commit07dc1947c362e187fb955d283b692f8769dd5def (patch)
tree5933d1a754972260a22d1bda9ea247bab7979dae /usr/src/tools/ctf/dwarf/common/dwarf_funcs.c
parentba2b2c94236651f014e4f9255b7075e654a853dd (diff)
downloadillumos-gate-07dc1947c362e187fb955d283b692f8769dd5def.tar.gz
2004 newer gcc, and sanity, would benefit from a newer libdwarf
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/tools/ctf/dwarf/common/dwarf_funcs.c')
-rw-r--r--usr/src/tools/ctf/dwarf/common/dwarf_funcs.c77
1 files changed, 43 insertions, 34 deletions
diff --git a/usr/src/tools/ctf/dwarf/common/dwarf_funcs.c b/usr/src/tools/ctf/dwarf/common/dwarf_funcs.c
index a7f3fee702..8d725ae33f 100644
--- a/usr/src/tools/ctf/dwarf/common/dwarf_funcs.c
+++ b/usr/src/tools/ctf/dwarf/common/dwarf_funcs.c
@@ -1,6 +1,7 @@
/*
- Copyright (C) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
+ Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
+ Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
@@ -19,10 +20,10 @@
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
- Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
+ Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
@@ -43,44 +44,52 @@
int
dwarf_get_funcs(Dwarf_Debug dbg,
- Dwarf_Func ** funcs,
- Dwarf_Signed * ret_func_count, Dwarf_Error * error)
+ Dwarf_Func ** funcs,
+ Dwarf_Signed * ret_func_count, Dwarf_Error * error)
{
- int res;
-
- res =
- _dwarf_load_section(dbg,
- dbg->de_debug_funcnames_index,
- &dbg->de_debug_funcnames,
- error);
+ int res = _dwarf_load_section(dbg, &dbg->de_debug_funcnames,error);
if (res != DW_DLV_OK) {
- return res;
+ return res;
}
- return _dwarf_internal_get_pubnames_like_data(dbg, dbg->de_debug_funcnames, dbg->de_debug_funcnames_size, (Dwarf_Global **) funcs, /* type
- punning,
- Dwarf_Type
- is never
- a
- completed
- type */
- ret_func_count,
- error,
- DW_DLA_FUNC_CONTEXT,
- DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD,
- DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR);
+ return _dwarf_internal_get_pubnames_like_data(dbg,
+ dbg->de_debug_funcnames.dss_data,
+ dbg->de_debug_funcnames.dss_size,
+ (Dwarf_Global **) funcs, /* Type punning for sections with identical format. */
+ ret_func_count,
+ error,
+ DW_DLA_FUNC_CONTEXT,
+ DW_DLA_FUNC,
+ DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD,
+ DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR);
+}
+
+/* Deallocating fully requires deallocating the list
+ and all entries. But some internal data is
+ not exposed, so we need a function with internal knowledge.
+*/
+void
+dwarf_funcs_dealloc(Dwarf_Debug dbg, Dwarf_Func * dwgl,
+ Dwarf_Signed count)
+{
+ _dwarf_internal_globals_dealloc(dbg, (Dwarf_Global *) dwgl,
+ count,
+ DW_DLA_FUNC_CONTEXT,
+ DW_DLA_FUNC, DW_DLA_LIST);
+ return;
}
+
int
dwarf_funcname(Dwarf_Func func_in, char **ret_name, Dwarf_Error * error)
{
Dwarf_Global func = (Dwarf_Global) func_in;
if (func == NULL) {
- _dwarf_error(NULL, error, DW_DLE_FUNC_NULL);
- return (DW_DLV_ERROR);
+ _dwarf_error(NULL, error, DW_DLE_FUNC_NULL);
+ return (DW_DLV_ERROR);
}
*ret_name = (char *) (func->gl_name);
@@ -89,7 +98,7 @@ dwarf_funcname(Dwarf_Func func_in, char **ret_name, Dwarf_Error * error)
int
dwarf_func_die_offset(Dwarf_Func func_in,
- Dwarf_Off * return_offset, Dwarf_Error * error)
+ Dwarf_Off * return_offset, Dwarf_Error * error)
{
Dwarf_Global func = (Dwarf_Global) func_in;
@@ -99,7 +108,7 @@ dwarf_func_die_offset(Dwarf_Func func_in,
int
dwarf_func_cu_offset(Dwarf_Func func_in,
- Dwarf_Off * return_offset, Dwarf_Error * error)
+ Dwarf_Off * return_offset, Dwarf_Error * error)
{
Dwarf_Global func = (Dwarf_Global) func_in;
@@ -109,13 +118,13 @@ dwarf_func_cu_offset(Dwarf_Func func_in,
int
dwarf_func_name_offsets(Dwarf_Func func_in,
- char **ret_func_name,
- Dwarf_Off * die_offset,
- Dwarf_Off * cu_die_offset, Dwarf_Error * error)
+ char **ret_func_name,
+ Dwarf_Off * die_offset,
+ Dwarf_Off * cu_die_offset, Dwarf_Error * error)
{
Dwarf_Global func = (Dwarf_Global) func_in;
return dwarf_global_name_offsets(func,
- ret_func_name,
- die_offset, cu_die_offset, error);
+ ret_func_name,
+ die_offset, cu_die_offset, error);
}