NEWS updates
diff --git a/NEWS b/NEWS
index d29f956..fcda7ce 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,14 @@
Version 0.116:
libdw: New functions dwarf_ranges, dwarf_entrypc, dwarf_diecu,
- dwarf_entry_breakpoints.
+ dwarf_entry_breakpoints. Removed Dwarf_Func type and functions
+ dwarf_func_name, dwarf_func_lowpc, dwarf_func_highpc,
+ dwarf_func_entrypc, dwarf_func_die; dwarf_getfuncs callback now uses
+ Dwarf_Die, and dwarf_func_file, dwarf_func_line, dwarf_func_col
+ replaced by dwarf_decl_file, dwarf_decl_line, dwarf_decl_column;
+ dwarf_func_inline, dwarf_func_inline_instances now take Dwarf_Die.
+ Type Dwarf_Loc renamed to Dwarf_Op; dwarf_getloclist,
+ dwarf_addrloclists renamed dwarf_getlocation, dwarf_getlocation_addr.
Version 0.115:
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index b74d26b..0c8539e 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -10,6 +10,45 @@
2005-10-26 Roland McGrath <roland@redhat.com>
+ * dwarf_getfuncs.c (dwarf_getfuncs): Use Dwarf_Die, not Dwarf_Func.
+ * dwarf_func_file.c: Renamed to ...
+ * dwarf_decl_file.c: ... here.
+ * dwarf_func_col.c: Renamed to ...
+ * dwarf_decl_column.c: ... here.
+ * dwarf_func_line.c: Renamed to ...
+ * dwarf_decl_line.c: ... here.
+ (dwarf_func_line): Renamed to ...
+ (dwarf_decl_line): ... this. Take a Dwarf_Die * argument.
+ (__libdw_func_intval): Renamed __libdw_attr_intval.
+ * dwarf_func_name.c: File removed.
+ * dwarf_func_lowpc.c: File removed.
+ * dwarf_func_highpc.c: File removed.
+ * dwarf_func_entrypc.c: File removed.
+ * dwarf_func_die.c: File removed.
+ * Makefile.am (libdw_a_SOURCES): Updated.
+ * libdw.h: Update decls.
+ (Dwarf_Func): Type removed.
+ * libdwP.h: Update decls.
+ (struct Dwarf_Func_s): Type removed.
+ * libdw.map: Updated.
+
+ * libdwP.h (CUDIE): New macro.
+ * dwarf_getlocation.c (dwarf_getlocation_addr): Use it.
+ * dwarf_getscopes_die.c (dwarf_getscopes_die): Likewise.
+ * dwarf_ranges.c (dwarf_ranges): Likewise.
+
+ * dwarf_getloclist.c: Renamed to ...
+ * dwarf_getlocation.c: ... here.
+ (getloclist): Renamed to getlocation.
+ (dwarf_getloclist): Renamed to dwarf_getlocation.
+ (dwarf_addrloclists): Renamed to dwarf_getlocation_addr.
+ * Makefile.am (libdw_a_SOURCES): Updated.
+ * libdw.h (dwarf_getloclist): Renamed to dwarf_getlocation.
+ (dwarf_addrloclists): Renamed dwarf_getlocation_addr.
+ (Dwarf_Loc): Renamed Dwarf_Op.
+ * libdwP.h (struct loc_s): Update use.
+ * libdw.map: Update map.
+
* dwarf_entry_breakpoints.c: Use the second line record within the
function, regardless of its source location data.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 1256713..6e53312 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -59,14 +59,13 @@
dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \
dwarf_onesrcline.c dwarf_formblock.c \
dwarf_getsrcfiles.c dwarf_filesrc.c \
- dwarf_getloclist.c dwarf_getstring.c dwarf_offabbrev.c \
+ dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \
dwarf_macro_param2.c dwarf_addrdie.c \
- dwarf_getfuncs.c dwarf_func_name.c dwarf_func_lowpc.c \
- dwarf_func_highpc.c dwarf_func_entrypc.c dwarf_func_file.c \
- dwarf_func_line.c dwarf_func_col.c dwarf_func_die.c \
+ dwarf_getfuncs.c \
+ dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
dwarf_func_inline.c dwarf_getsrc_file.c \
libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
libdw_visit_scopes.c \
diff --git a/libdw/dwarf_func_name.c b/libdw/dwarf_decl_column.c
similarity index 80%
rename from libdw/dwarf_func_name.c
rename to libdw/dwarf_decl_column.c
index c6912aa..aae232f 100644
--- a/libdw/dwarf_func_name.c
+++ b/libdw/dwarf_decl_column.c
@@ -1,4 +1,4 @@
-/* Get function name.
+/* Get column number of beginning of given declaration.
Copyright (C) 2005 Red Hat, Inc.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -20,8 +20,8 @@
#include "libdwP.h"
-const char *
-dwarf_func_name (Dwarf_Func *func)
+int
+dwarf_decl_column (Dwarf_Die *decl, int *colp)
{
- return INTUSE(dwarf_diename) (func->die);
+ return __libdw_attr_intval (decl, colp, DW_AT_decl_column);
}
diff --git a/libdw/dwarf_func_file.c b/libdw/dwarf_decl_file.c
similarity index 91%
rename from libdw/dwarf_func_file.c
rename to libdw/dwarf_decl_file.c
index d5302df..50a3ab3 100644
--- a/libdw/dwarf_func_file.c
+++ b/libdw/dwarf_decl_file.c
@@ -22,11 +22,10 @@
const char *
-dwarf_func_file (Dwarf_Func *func)
+dwarf_decl_file (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Sword idx = 0;
- Dwarf_Die *die = func->die;
if (INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (die, DW_AT_decl_file,
&attr_mem), &idx) != 0)
@@ -40,7 +39,7 @@
}
/* Get the array of source files for the CU. */
- struct Dwarf_CU *cu = die->cu;
+ struct Dwarf_CU *cu = die->cu;
if (cu->lines == NULL)
{
Dwarf_Lines *lines;
@@ -48,7 +47,7 @@
/* Let the more generic function do the work. It'll create more
data but that will be needed in an real program anyway. */
- (void) INTUSE(dwarf_getsrclines) (func->cudie, &lines, &nlines);
+ (void) INTUSE(dwarf_getsrclines) (&CUDIE (cu), &lines, &nlines);
assert (cu->lines != NULL);
}
diff --git a/libdw/dwarf_func_line.c b/libdw/dwarf_decl_line.c
similarity index 80%
rename from libdw/dwarf_func_line.c
rename to libdw/dwarf_decl_line.c
index 6259b9f..44a9524 100644
--- a/libdw/dwarf_func_line.c
+++ b/libdw/dwarf_decl_line.c
@@ -23,19 +23,19 @@
int
-dwarf_func_line (Dwarf_Func *func, int *linep)
+dwarf_decl_line (Dwarf_Die *func, int *linep)
{
- return __libdw_func_intval (func, linep, DW_AT_decl_line);
+ return __libdw_attr_intval (func, linep, DW_AT_decl_line);
}
int internal_function
-__libdw_func_intval (Dwarf_Func *func, int *linep, int attval)
+__libdw_attr_intval (Dwarf_Die *die, int *linep, int attval)
{
Dwarf_Attribute attr_mem;
Dwarf_Sword line;
- int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (func->die, attval,
+ int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (die, attval,
&attr_mem), &line);
if (res == 0)
{
diff --git a/libdw/dwarf_func_col.c b/libdw/dwarf_func_col.c
deleted file mode 100644
index feda143..0000000
--- a/libdw/dwarf_func_col.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Get line number of beginning of given function.
- Copyright (C) 2005 Red Hat, Inc.
- Written by Ulrich Drepper <drepper@redhat.com>, 2005.
-
- This program is Open Source software; you can redistribute it and/or
- modify it under the terms of the Open Software License version 1.0 as
- published by the Open Source Initiative.
-
- You should have received a copy of the Open Software License along
- with this program; if not, you may obtain a copy of the Open Software
- License version 1.0 from http://www.opensource.org/licenses/osl.php or
- by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
- 3001 King Ranch Road, Ukiah, CA 95482. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <dwarf.h>
-#include "libdwP.h"
-
-
-int
-dwarf_func_col (Dwarf_Func *func, int *colp)
-{
- return __libdw_func_intval (func, colp, DW_AT_decl_column);
-}
diff --git a/libdw/dwarf_func_die.c b/libdw/dwarf_func_die.c
deleted file mode 100644
index 73c65d4..0000000
--- a/libdw/dwarf_func_die.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Get definition DIE of function.
- Copyright (C) 2005 Red Hat, Inc.
-
- This program is Open Source software; you can redistribute it and/or
- modify it under the terms of the Open Software License version 1.0 as
- published by the Open Source Initiative.
-
- You should have received a copy of the Open Software License along
- with this program; if not, you may obtain a copy of the Open Software
- License version 1.0 from http://www.opensource.org/licenses/osl.php or
- by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
- 3001 King Ranch Road, Ukiah, CA 95482. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <dwarf.h>
-#include "libdwP.h"
-
-
-Dwarf_Die *
-dwarf_func_die (Dwarf_Func *func, Dwarf_Die *die_mem)
-{
- *die_mem = *func->die;
- return die_mem;
-}
diff --git a/libdw/dwarf_func_entrypc.c b/libdw/dwarf_func_entrypc.c
deleted file mode 100644
index 6b5103e..0000000
--- a/libdw/dwarf_func_entrypc.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Get entry address of function.
- Copyright (C) 2005 Red Hat, Inc.
- Written by Ulrich Drepper <drepper@redhat.com>, 2005.
-
- This program is Open Source software; you can redistribute it and/or
- modify it under the terms of the Open Software License version 1.0 as
- published by the Open Source Initiative.
-
- You should have received a copy of the Open Software License along
- with this program; if not, you may obtain a copy of the Open Software
- License version 1.0 from http://www.opensource.org/licenses/osl.php or
- by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
- 3001 King Ranch Road, Ukiah, CA 95482. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <dwarf.h>
-#include "libdwP.h"
-
-
-int
-dwarf_func_entrypc (Dwarf_Func *func, Dwarf_Addr *return_addr)
-{
- Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (func->die, DW_AT_entry_pc,
- &attr_mem);
- if (attr != NULL)
- return INTUSE(dwarf_formaddr) (attr, return_addr);
-
- return INTUSE(dwarf_lowpc) (func->die, return_addr);
-}
diff --git a/libdw/dwarf_func_highpc.c b/libdw/dwarf_func_highpc.c
deleted file mode 100644
index c5d2eec..0000000
--- a/libdw/dwarf_func_highpc.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Get end address of function.
- Copyright (C) 2005 Red Hat, Inc.
- Written by Ulrich Drepper <drepper@redhat.com>, 2005.
-
- This program is Open Source software; you can redistribute it and/or
- modify it under the terms of the Open Software License version 1.0 as
- published by the Open Source Initiative.
-
- You should have received a copy of the Open Software License along
- with this program; if not, you may obtain a copy of the Open Software
- License version 1.0 from http://www.opensource.org/licenses/osl.php or
- by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
- 3001 King Ranch Road, Ukiah, CA 95482. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "libdwP.h"
-
-
-int
-dwarf_func_highpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
-{
- return INTUSE(dwarf_highpc) (func->die, return_addr);
-}
diff --git a/libdw/dwarf_func_inline.c b/libdw/dwarf_func_inline.c
index 4472515..99e656f 100644
--- a/libdw/dwarf_func_inline.c
+++ b/libdw/dwarf_func_inline.c
@@ -39,11 +39,11 @@
}
int
-dwarf_func_inline (Dwarf_Func *func)
+dwarf_func_inline (Dwarf_Die *func)
{
Dwarf_Attribute attr_mem;
Dwarf_Word val;
- if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (func->die, DW_AT_inline,
+ if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (func, DW_AT_inline,
&attr_mem),
&val) == 0)
switch (val)
@@ -63,11 +63,11 @@
}
int
-dwarf_func_inline_instances (Dwarf_Func *func,
+dwarf_func_inline_instances (Dwarf_Die *func,
int (*callback) (Dwarf_Die *, void *),
void *arg)
{
- struct visitor_info v = { func->die->addr, callback, arg };
- struct Dwarf_Die_Chain cu = { .die = *func->cudie, .parent = NULL };
+ struct visitor_info v = { func->addr, callback, arg };
+ struct Dwarf_Die_Chain cu = { .die = CUDIE (func->cu), .parent = NULL };
return __libdw_visit_scopes (0, &cu, &scope_visitor, NULL, &v);
}
diff --git a/libdw/dwarf_func_lowpc.c b/libdw/dwarf_func_lowpc.c
deleted file mode 100644
index d364e6c..0000000
--- a/libdw/dwarf_func_lowpc.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Get start address of function.
- Copyright (C) 2005 Red Hat, Inc.
- Written by Ulrich Drepper <drepper@redhat.com>, 2005.
-
- This program is Open Source software; you can redistribute it and/or
- modify it under the terms of the Open Software License version 1.0 as
- published by the Open Source Initiative.
-
- You should have received a copy of the Open Software License along
- with this program; if not, you may obtain a copy of the Open Software
- License version 1.0 from http://www.opensource.org/licenses/osl.php or
- by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
- 3001 King Ranch Road, Ukiah, CA 95482. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "libdwP.h"
-
-
-int
-dwarf_func_lowpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
-{
- return INTUSE(dwarf_lowpc) (func->die, return_addr);
-}
diff --git a/libdw/dwarf_getfuncs.c b/libdw/dwarf_getfuncs.c
index 149f186..f967678 100644
--- a/libdw/dwarf_getfuncs.c
+++ b/libdw/dwarf_getfuncs.c
@@ -21,7 +21,7 @@
ptrdiff_t
-dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Func *, void *),
+dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *),
void *arg, ptrdiff_t offset)
{
if (unlikely (cudie == NULL
@@ -45,12 +45,7 @@
{
if (INTUSE(dwarf_tag) (die) == DW_TAG_subprogram)
{
- Dwarf_Func fct;
-
- fct.die = die;
- fct.cudie = cudie;
-
- if (callback (&fct, arg) != DWARF_CB_OK)
+ if (callback (die, arg) != DWARF_CB_OK)
return INTUSE(dwarf_dieoffset) (die);
}
diff --git a/libdw/dwarf_getloclist.c b/libdw/dwarf_getlocation.c
similarity index 92%
rename from libdw/dwarf_getloclist.c
rename to libdw/dwarf_getlocation.c
index ab7c386..4a75f97 100644
--- a/libdw/dwarf_getloclist.c
+++ b/libdw/dwarf_getlocation.c
@@ -76,8 +76,8 @@
}
static int
-getloclist (struct Dwarf_CU *cu, const Dwarf_Block *block,
- Dwarf_Loc **llbuf, size_t *listlen)
+getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block,
+ Dwarf_Op **llbuf, size_t *listlen)
{
Dwarf *dbg = cu->dbg;
@@ -269,7 +269,7 @@
}
/* Allocate the array. */
- Dwarf_Loc *result = libdw_alloc (dbg, Dwarf_Loc, sizeof (Dwarf_Loc), n);
+ Dwarf_Op *result = libdw_alloc (dbg, Dwarf_Op, sizeof (Dwarf_Op), n);
/* Store the result. */
*llbuf = result;
@@ -303,9 +303,9 @@
}
int
-dwarf_getloclist (attr, llbuf, listlen)
+dwarf_getlocation (attr, llbuf, listlen)
Dwarf_Attribute *attr;
- Dwarf_Loc **llbuf;
+ Dwarf_Op **llbuf;
size_t *listlen;
{
if (! attr_ok (attr))
@@ -316,14 +316,14 @@
if (INTUSE(dwarf_formblock) (attr, &block) != 0)
return -1;
- return getloclist (attr->cu, &block, llbuf, listlen);
+ return getlocation (attr->cu, &block, llbuf, listlen);
}
int
-dwarf_addrloclists (attr, address, llbufs, listlens, maxlocs)
+dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs)
Dwarf_Attribute *attr;
Dwarf_Addr address;
- Dwarf_Loc **llbufs;
+ Dwarf_Op **llbufs;
size_t *listlens;
size_t maxlocs;
{
@@ -340,7 +340,7 @@
if (maxlocs == 0)
return 0;
if (llbufs != NULL &&
- getloclist (attr->cu, &block, &llbufs[0], &listlens[0]) != 0)
+ getlocation (attr->cu, &block, &llbufs[0], &listlens[0]) != 0)
return -1;
return listlens[0] == 0 ? 0 : 1;
}
@@ -366,13 +366,7 @@
/* Fetch the CU's base address. */
Dwarf_Addr base;
- Dwarf_Die cudie =
- {
- .cu = attr->cu,
- .addr = ((char *) attr->cu->dbg->sectiondata[IDX_debug_info]->d_buf
- + attr->cu->start + 3 * attr->cu->offset_size - 4 + 3),
- };
-
+ Dwarf_Die cudie = CUDIE (attr->cu);
/* Find the base address of the compilation unit. It will
normally be specified by DW_AT_low_pc. In DWARF-3 draft 4,
@@ -443,8 +437,9 @@
if (address >= base + begin && address < base + end)
{
/* This one matches the address. */
- if (llbufs != NULL && getloclist (attr->cu, &block,
- &llbufs[got], &listlens[got]) != 0)
+ if (llbufs != NULL
+ && getlocation (attr->cu, &block,
+ &llbufs[got], &listlens[got]) != 0)
return -1;
++got;
}
diff --git a/libdw/dwarf_getscopes_die.c b/libdw/dwarf_getscopes_die.c
index bdcee35..6e46f66 100644
--- a/libdw/dwarf_getscopes_die.c
+++ b/libdw/dwarf_getscopes_die.c
@@ -50,17 +50,7 @@
if (die == NULL)
return -1;
- struct Dwarf_Die_Chain cu =
- {
- .parent = NULL,
- .die =
- {
- .cu = die->cu,
- .addr = ((char *) die->cu->dbg->sectiondata[IDX_debug_info]->d_buf
- + die->cu->start + 3 * die->cu->offset_size - 4 + 3),
- }
- };
-
+ struct Dwarf_Die_Chain cu = { .die = CUDIE (die->cu), .parent = NULL };
void *info = die->addr;
int result = __libdw_visit_scopes (1, &cu, &scope_visitor, NULL, &info);
if (result > 0)
diff --git a/libdw/dwarf_getscopevar.c b/libdw/dwarf_getscopevar.c
index 3ceb292..fcac198 100644
--- a/libdw/dwarf_getscopevar.c
+++ b/libdw/dwarf_getscopevar.c
@@ -25,13 +25,7 @@
static int
getfiles (Dwarf_Die *die, Dwarf_Files **files)
{
- Dwarf_Die cudie =
- {
- .cu = die->cu,
- .addr = ((char *) die->cu->dbg->sectiondata[IDX_debug_info]->d_buf
- + 3 * die->cu->offset_size - 4 + 3),
- };
- return INTUSE(dwarf_getsrcfiles) (&cudie, files, NULL);
+ return INTUSE(dwarf_getsrcfiles) (&CUDIE (die->cu), files, NULL);
}
/* Fetch an attribute that should have a constant integer form. */
diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c
index 546bcac..5d6710a 100644
--- a/libdw/dwarf_ranges.c
+++ b/libdw/dwarf_ranges.c
@@ -65,13 +65,7 @@
assert ((Dwarf_Word) offset == start_offset);
/* Fetch the CU's base address. */
- Dwarf_Die cudie =
- {
- .cu = attr->cu,
- .addr = ((char *) attr->cu->dbg->sectiondata[IDX_debug_info]->d_buf
- + attr->cu->start + 3 * attr->cu->offset_size - 4 + 3),
- };
- if (INTUSE(dwarf_lowpc) (&cudie, basep) != 0)
+ if (INTUSE(dwarf_lowpc) (&CUDIE (attr->cu), basep) != 0)
return -1;
}
else if (offset < 0 || (size_t) offset >= d->d_size)
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 2bce26b..69eb903 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -90,9 +90,6 @@
/* CU representation. */
struct Dwarf_CU;
-/* Function information. */
-typedef struct Dwarf_Func_s Dwarf_Func;
-
/* Macro information. */
typedef struct Dwarf_Macro_s Dwarf_Macro;
@@ -138,15 +135,15 @@
} Dwarf_Global;
-// XXX It remains to be seen whether the next two need to be exported.
-/* Location record. */
+/* One operation in a DWARF location expression.
+ A location expression is an array of these. */
typedef struct
{
uint8_t atom; /* Operation */
Dwarf_Word number; /* Operand */
Dwarf_Word number2; /* Possible second operand */
Dwarf_Word offset; /* Offset in location expression */
-} Dwarf_Loc;
+} Dwarf_Op;
/* Handle for debug sessions. */
@@ -436,21 +433,21 @@
Dwarf_Word *mtime, Dwarf_Word *length);
-/* Return location expression list. */
-extern int dwarf_getloclist (Dwarf_Attribute *attr, Dwarf_Loc **llbuf,
- size_t *listlen) __nonnull_attribute__ (2, 3);
+/* Return location expression, decoded as a list of operations. */
+extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr,
+ size_t *exprlen) __nonnull_attribute__ (2, 3);
-/* Return location expression lists. If the attribute uses a location
- list, ADDRESS selects the relevant location expressions from the list.
+/* Return location expressions. If the attribute uses a location list,
+ ADDRESS selects the relevant location expressions from the list.
There can be multiple matches, resulting in multiple expressions to
- return. LLBUFS and LISTLENS are parallel arrays of NLOCS slots to fill
- in. Returns the number of locations filled in, or -1 for errors. If
- LLBUFS is a null pointer, stores nothing and returns the total number of
- locations. A return value of zero means that the location list
- indicated no value is accessible. */
-extern int dwarf_addrloclists (Dwarf_Attribute *attr, Dwarf_Addr address,
- Dwarf_Loc **llbufs, size_t *listlens,
- size_t nlocs);
+ return. EXPRS and EXPRLENS are parallel arrays of NLOCS slots to
+ fill in. Returns the number of locations filled in, or -1 for
+ errors. If EXPRS is a null pointer, stores nothing and returns the
+ total number of locations. A return value of zero means that the
+ location list indicated no value is accessible. */
+extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address,
+ Dwarf_Op **exprs, size_t *exprlens,
+ size_t nlocs);
/* Return scope DIEs containing PC address.
@@ -508,44 +505,27 @@
/* Get functions in CUDIE. */
extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
- int (*callback) (Dwarf_Func *, void *),
+ int (*callback) (Dwarf_Die *, void *),
void *arg, ptrdiff_t offset);
-/* Return name of function. */
-extern const char *dwarf_func_name (Dwarf_Func *func);
-/* Return start address of function. */
-extern int dwarf_func_lowpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
+/* Return file name containing definition of the given declaration. */
+extern const char *dwarf_decl_file (Dwarf_Die *decl);
+
+/* Get line number of beginning of given declaration. */
+extern int dwarf_decl_line (Dwarf_Die *decl, int *linep)
__nonnull_attribute__ (2);
-/* Return end address of function. */
-extern int dwarf_func_highpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
+/* Get column number of beginning of given declaration. */
+extern int dwarf_decl_column (Dwarf_Die *decl, int *colp)
__nonnull_attribute__ (2);
-/* Return entry point address of function. */
-extern int dwarf_func_entrypc (Dwarf_Func *func, Dwarf_Addr *return_addr)
- __nonnull_attribute__ (2);
-
-/* Return file name containing definition of the given function. */
-extern const char *dwarf_func_file (Dwarf_Func *func);
-
-/* Get line number of beginning of given function. */
-extern int dwarf_func_line (Dwarf_Func *func, int *linep)
- __nonnull_attribute__ (2);
-
-/* Get column number of beginning of given function. */
-extern int dwarf_func_col (Dwarf_Func *func, int *colp)
- __nonnull_attribute__ (2);
-
-/* Get definition DIE of given function. */
-extern Dwarf_Die *dwarf_func_die (Dwarf_Func *func, Dwarf_Die *die_mem)
- __nonnull_attribute__ (2);
/* Return nonzero if given function is an abstract inline definition. */
-extern int dwarf_func_inline (Dwarf_Func *func);
+extern int dwarf_func_inline (Dwarf_Die *func);
/* Find each concrete inlined instance of the abstract inline definition. */
-extern int dwarf_func_inline_instances (Dwarf_Func *func,
+extern int dwarf_func_inline_instances (Dwarf_Die *func,
int (*callback) (Dwarf_Die *, void *),
void *arg);
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 3849b32..493df48 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -3,10 +3,9 @@
global:
dwarf_abbrevhaschildren;
dwarf_addrdie;
- dwarf_addrloclists;
+ dwarf_arrayorder;
dwarf_attr;
dwarf_attr_integrate;
- dwarf_arrayorder;
dwarf_begin;
dwarf_begin_elf;
dwarf_bitoffset;
@@ -14,14 +13,17 @@
dwarf_bytesize;
dwarf_child;
dwarf_cuoffset;
+ dwarf_decl_column;
+ dwarf_decl_file;
+ dwarf_decl_line;
+ dwarf_diecu;
dwarf_diename;
dwarf_dieoffset;
- dwarf_diecu;
dwarf_end;
+ dwarf_entry_breakpoints;
+ dwarf_entrypc;
dwarf_errmsg;
dwarf_errno;
- dwarf_entrypc;
- dwarf_entry_breakpoints;
dwarf_filesrc;
dwarf_formaddr;
dwarf_formblock;
@@ -31,16 +33,8 @@
dwarf_formsdata;
dwarf_formstring;
dwarf_formudata;
- dwarf_func_col;
- dwarf_func_die;
- dwarf_func_entrypc;
- dwarf_func_file;
- dwarf_func_highpc;
dwarf_func_inline;
dwarf_func_inline_instances;
- dwarf_func_line;
- dwarf_func_lowpc;
- dwarf_func_name;
dwarf_getabbrev;
dwarf_getabbrevattr;
dwarf_getabbrevcode;
@@ -52,13 +46,14 @@
dwarf_getattrs;
dwarf_getelf;
dwarf_getfuncs;
- dwarf_getloclist;
+ dwarf_getlocation;
+ dwarf_getlocation_addr;
dwarf_getmacros;
dwarf_getpubnames;
+ dwarf_getscn_info;
dwarf_getscopes;
dwarf_getscopes_die;
dwarf_getscopevar;
- dwarf_getscn_info;
dwarf_getsrc_die;
dwarf_getsrc_file;
dwarf_getsrcfiles;
@@ -66,9 +61,9 @@
dwarf_getstring;
dwarf_hasattr;
dwarf_hasattr_integrate;
- dwarf_haspc;
dwarf_haschildren;
dwarf_hasform;
+ dwarf_haspc;
dwarf_highpc;
dwarf_lineaddr;
dwarf_linebeginstatement;
@@ -83,12 +78,12 @@
dwarf_macro_opcode;
dwarf_macro_param1;
dwarf_macro_param2;
+ dwarf_new_oom_handler;
+ dwarf_nextcu;
dwarf_offabbrev;
dwarf_offdie;
dwarf_onearange;
dwarf_onesrcline;
- dwarf_nextcu;
- dwarf_new_oom_handler;
dwarf_ranges;
dwarf_siblingof;
dwarf_srclang;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 4dbe77e..436287d 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -32,11 +32,11 @@
#define CIE_VERSION 1
-/* Known location lists. */
+/* Known location expressions already decoded. */
struct loc_s
{
void *addr;
- Dwarf_Loc *loc;
+ Dwarf_Op *loc;
size_t nloc;
};
@@ -247,14 +247,13 @@
void *locs;
};
-
-/* Function information. */
-struct Dwarf_Func_s
-{
- // XXX If we want to cache functions, we need to change this struct.
- Dwarf_Die *die;
- Dwarf_Die *cudie;
-};
+#define CUDIE(fromcu) \
+ ((Dwarf_Die) \
+ { \
+ .cu = (fromcu), \
+ .addr = ((char *) (fromcu)->dbg->sectiondata[IDX_debug_info]->d_buf \
+ + (fromcu)->start + 3 * (fromcu)->offset_size - 4 + 3), \
+ })
/* Macro information. */
@@ -339,7 +338,7 @@
__nonnull_attribute__ (1) internal_function;
/* Helper function to access integer attribute. */
-extern int __libdw_func_intval (Dwarf_Func *func, int *linep, int attval)
+extern int __libdw_attr_intval (Dwarf_Die *die, int *valp, int attval)
__nonnull_attribute__ (1, 2) internal_function;
/* Helper function to walk scopes. */
diff --git a/src/ChangeLog b/src/ChangeLog
index 4139c7d..2f7ba0f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-26 Roland McGrath <roland@redhat.com>
+
+ * nm.c (get_var_range): dwarf_getloclist -> dwarf_getlocation.
+
2005-09-03 Ulrich Drepper <drepper@redhat.com>
* strip.c (handle_elf): Unify some error messages.
diff --git a/src/nm.c b/src/nm.c
index 66e0b21..d4d66be 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -582,9 +582,9 @@
if (locattr == NULL)
return 1;
- Dwarf_Loc *loc;
+ Dwarf_Op *loc;
size_t nloc;
- if (dwarf_getloclist (locattr, &loc, &nloc) != 0)
+ if (dwarf_getlocation (locattr, &loc, &nloc) != 0)
return 1;
/* Interpret the location expressions. */
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 37da62c..aa6d650 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
2005-10-27 Roland McGrath <roland@redhat.com>
+ * allfcts.c (cb): Update for dwarf_func_* -> dwarf_decl_* changes.
+ * funcscopes.c (handle_function): Likewise.
+ * dwflmodtest.c (print_inline, print_func): Likewise.
+ * find-prologues.c (handle_function): Likewise.
+
+2005-10-27 Roland McGrath <roland@redhat.com>
+
* run-find-prologues.sh: New file.
* Makefile.am (TESTS, EXTRA_DIST): Add it.
diff --git a/tests/allfcts.c b/tests/allfcts.c
index 147ebc2..f414983 100644
--- a/tests/allfcts.c
+++ b/tests/allfcts.c
@@ -5,12 +5,12 @@
static int
-cb (Dwarf_Func *func, void *arg __attribute__ ((unused)))
+cb (Dwarf_Die *func, void *arg __attribute__ ((unused)))
{
- const char *file = dwarf_func_file (func);
+ const char *file = dwarf_decl_file (func);
int line = -1;
- dwarf_func_line (func, &line);
- const char *fct = dwarf_func_name (func);
+ dwarf_decl_line (func, &line);
+ const char *fct = dwarf_diename (func);
printf ("%s:%d:%s\n", file, line, fct);
diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
index 5155f6c..77d437a 100644
--- a/tests/dwflmodtest.c
+++ b/tests/dwflmodtest.c
@@ -100,21 +100,21 @@
}
static void
-print_inline (Dwarf_Func *func, void *arg)
+print_inline (Dwarf_Die *func, void *arg)
{
if (dwarf_func_inline_instances (func, &print_instance, arg) != 0)
printf (" error finding instances: %s\n", dwarf_errmsg (-1));
}
static int
-print_func (Dwarf_Func *func, void *arg)
+print_func (Dwarf_Die *func, void *arg)
{
const struct info *info = arg;
- const char *file = dwarf_func_file (func);
+ const char *file = dwarf_decl_file (func);
int line = -1;
- dwarf_func_line (func, &line);
- const char *fct = dwarf_func_name (func);
+ dwarf_decl_line (func, &line);
+ const char *fct = dwarf_diename (func);
printf (" %s:%d: %s:", file, line, fct);
@@ -127,15 +127,15 @@
else
{
Dwarf_Addr lo = -1, hi = -1, entry = -1;
- if (dwarf_func_lowpc (func, &lo) == 0)
+ if (dwarf_lowpc (func, &lo) == 0)
lo += info->dwbias;
else
printf (" (lowpc => %s)", dwarf_errmsg (-1));
- if (dwarf_func_highpc (func, &hi) == 0)
+ if (dwarf_highpc (func, &hi) == 0)
hi += info->dwbias;
else
printf (" (highpc => %s)", dwarf_errmsg (-1));
- if (dwarf_func_entrypc (func, &entry) == 0)
+ if (dwarf_entrypc (func, &entry) == 0)
entry += info->dwbias;
else
printf (" (entrypc => %s)", dwarf_errmsg (-1));
diff --git a/tests/find-prologues.c b/tests/find-prologues.c
index 30404cd..0a2e86e 100644
--- a/tests/find-prologues.c
+++ b/tests/find-prologues.c
@@ -35,11 +35,11 @@
};
static int
-handle_function (Dwarf_Func *func, void *arg)
+handle_function (Dwarf_Die *func, void *arg)
{
struct args *a = arg;
- const char *name = dwarf_func_name (func);
+ const char *name = dwarf_diename (func);
char **argv = a->argv;
if (argv[0] != NULL)
{
@@ -51,23 +51,19 @@
return 0;
}
- Dwarf_Die funcdie_mem;
- Dwarf_Die *funcdie = dwarf_func_die (func, &funcdie_mem);
- assert (funcdie == &funcdie_mem);
-
if (dwarf_func_inline (func))
return 0;
Dwarf_Addr entrypc;
- if (dwarf_entrypc (funcdie, &entrypc) != 0)
+ if (dwarf_entrypc (func, &entrypc) != 0)
error (EXIT_FAILURE, 0, "dwarf_entrypc: %s: %s",
- dwarf_diename (funcdie), dwarf_errmsg (-1));
+ dwarf_diename (func), dwarf_errmsg (-1));
entrypc += a->dwbias;
- printf ("%-16s %#.16" PRIx64, dwarf_diename (funcdie), entrypc);
+ printf ("%-16s %#.16" PRIx64, dwarf_diename (func), entrypc);
Dwarf_Addr *bkpts = NULL;
- int result = dwarf_entry_breakpoints (funcdie, &bkpts);
+ int result = dwarf_entry_breakpoints (func, &bkpts);
if (result <= 0)
printf ("\t%s\n", dwarf_errmsg (-1));
else
diff --git a/tests/funcscopes.c b/tests/funcscopes.c
index a74e8d8..3318f31 100644
--- a/tests/funcscopes.c
+++ b/tests/funcscopes.c
@@ -98,11 +98,11 @@
};
static int
-handle_function (Dwarf_Func *func, void *arg)
+handle_function (Dwarf_Die *funcdie, void *arg)
{
struct args *a = arg;
- const char *name = dwarf_func_name (func);
+ const char *name = dwarf_diename (funcdie);
char **argv = a->argv;
if (argv[0] != NULL)
{
@@ -114,10 +114,6 @@
return 0;
}
- Dwarf_Die funcdie_mem;
- Dwarf_Die *funcdie = dwarf_func_die (func, &funcdie_mem);
- assert (funcdie == &funcdie_mem);
-
Dwarf_Die *scopes;
int n = dwarf_getscopes_die (funcdie, &scopes);
if (n <= 0)