]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
NEWS updates
authorRoland McGrath <roland@redhat.com>
Fri, 28 Oct 2005 07:07:19 +0000 (07:07 +0000)
committerRoland McGrath <roland@redhat.com>
Fri, 28 Oct 2005 07:07:19 +0000 (07:07 +0000)
27 files changed:
NEWS
libdw/ChangeLog
libdw/Makefile.am
libdw/dwarf_decl_column.c [moved from libdw/dwarf_func_col.c with 81% similarity]
libdw/dwarf_decl_file.c [moved from libdw/dwarf_func_file.c with 91% similarity]
libdw/dwarf_decl_line.c [moved from libdw/dwarf_func_line.c with 80% similarity]
libdw/dwarf_func_die.c [deleted file]
libdw/dwarf_func_entrypc.c [deleted file]
libdw/dwarf_func_highpc.c [deleted file]
libdw/dwarf_func_inline.c
libdw/dwarf_func_lowpc.c [deleted file]
libdw/dwarf_func_name.c [deleted file]
libdw/dwarf_getfuncs.c
libdw/dwarf_getlocation.c [moved from libdw/dwarf_getloclist.c with 92% similarity]
libdw/dwarf_getscopes_die.c
libdw/dwarf_getscopevar.c
libdw/dwarf_ranges.c
libdw/libdw.h
libdw/libdw.map
libdw/libdwP.h
src/ChangeLog
src/nm.c
tests/ChangeLog
tests/allfcts.c
tests/dwflmodtest.c
tests/find-prologues.c
tests/funcscopes.c

diff --git a/NEWS b/NEWS
index d29f956f6854f3e0cefc0183e73852bbaea1e704..fcda7cef39a8b46f434378470e9324f52f3971b8 100644 (file)
--- 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:
 
index b74d26b09ae46a3e69f895ffa04e00421b9615b8..0c8539efde0f8ca5da25ce23a5a9425ac25d5589 100644 (file)
 
 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.
 
index 125671393872749728f33c8c0b9616fc0d2f46ad..6e53312e10bf9de36c879fb7ac61af59308d2458 100644 (file)
@@ -59,14 +59,13 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
                  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 \
similarity index 81%
rename from libdw/dwarf_func_col.c
rename to libdw/dwarf_decl_column.c
index feda14354445985a5473102e6253c6ee2ad3c333..aae232fa7e9fc8eeb6d1cd5a84da8c1cb90111cc 100644 (file)
@@ -1,4 +1,4 @@
-/* Get line number of beginning of given function.
+/* Get column number of beginning of given declaration.
    Copyright (C) 2005 Red Hat, Inc.
    Written by Ulrich Drepper <drepper@redhat.com>, 2005.
 
@@ -21,7 +21,7 @@
 
 
 int
-dwarf_func_col (Dwarf_Func *func, int *colp)
+dwarf_decl_column (Dwarf_Die *decl, int *colp)
 {
-  return __libdw_func_intval (func, colp, DW_AT_decl_column);
+  return __libdw_attr_intval (decl, colp, DW_AT_decl_column);
 }
similarity index 91%
rename from libdw/dwarf_func_file.c
rename to libdw/dwarf_decl_file.c
index d5302df02deb94bb903c630878b45996d16cb5e6..50a3ab3a85d3c696d941de2c5c00e1a89807964a 100644 (file)
 
 
 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 @@ dwarf_func_file (Dwarf_Func *func)
     }
 
   /* 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 @@ dwarf_func_file (Dwarf_Func *func)
 
       /* 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);
     }
 
similarity index 80%
rename from libdw/dwarf_func_line.c
rename to libdw/dwarf_decl_line.c
index 6259b9f157a37af3001df6373a856eb3095abbaa..44a952430b84875d8143991e356ae1959fcece60 100644 (file)
 
 
 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_die.c b/libdw/dwarf_func_die.c
deleted file mode 100644 (file)
index 73c65d4..0000000
+++ /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 (file)
index 6b5103e..0000000
+++ /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 (file)
index c5d2eec..0000000
+++ /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);
-}
index 4472515d3565df31102d058552026af5a14315fb..99e656ffbc0e5fb29c8f0d5afae66e37b73e16d1 100644 (file)
@@ -39,11 +39,11 @@ scope_visitor (unsigned int depth __attribute__ ((unused)),
 }
 
 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 @@ dwarf_func_inline (Dwarf_Func *func)
 }
 
 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 (file)
index d364e6c..0000000
+++ /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_func_name.c b/libdw/dwarf_func_name.c
deleted file mode 100644 (file)
index c6912aa..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Get function name.
-   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"
-
-
-const char *
-dwarf_func_name (Dwarf_Func *func)
-{
-  return INTUSE(dwarf_diename) (func->die);
-}
index 149f1860d02186248fdcc611c98836d3ba4277fb..f967678ba0d2a571897550319f15e1790fe3e6e7 100644 (file)
@@ -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 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Func *, void *),
     {
       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);
        }
 
similarity index 92%
rename from libdw/dwarf_getloclist.c
rename to libdw/dwarf_getlocation.c
index ab7c38699a848f867157a364e0c15a7e59240de0..4a75f97d8088241bafe56cb294753c6d249446be 100644 (file)
@@ -76,8 +76,8 @@ loc_compare (const void *p1, const void *p2)
 }
 
 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 @@ getloclist (struct Dwarf_CU *cu, const Dwarf_Block *block,
     }
 
   /* 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 @@ getloclist (struct Dwarf_CU *cu, const Dwarf_Block *block,
 }
 
 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 @@ dwarf_getloclist (attr, llbuf, listlen)
   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 @@ dwarf_addrloclists (attr, address, llbufs, listlens, maxlocs)
       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 @@ dwarf_addrloclists (attr, address, llbufs, listlens, maxlocs)
 
   /* 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 @@ dwarf_addrloclists (attr, address, llbufs, listlens, maxlocs)
       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;
        }
index bdcee3540316f4476867117f0ba6701977168739..6e46f666bcee5eab16765bee43d2f754ef9beddb 100644 (file)
@@ -50,17 +50,7 @@ dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes)
   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)
index 3ceb292d90b3f0b08c511f7e4238707da7fb0254..fcac1987b2e0febd2a05cb57ab17a9d5ac5f5c5a 100644 (file)
 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.  */
index 546bcac03e5a6987238bc57243629cd0ae72ea60..5d6710a096b06ccef0ac9211d478ca77dcf87a90 100644 (file)
@@ -65,13 +65,7 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
       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)
index 2bce26bd85a353b218f169a90ab70f1cb26c2f86..69eb903fb79fab06569bd3110d2f529811420cc0 100644 (file)
@@ -90,9 +90,6 @@ typedef struct Dwarf_Aranges_s Dwarf_Aranges;
 /* 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 @@ typedef struct
 } 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 @@ extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx,
                                  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 @@ extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
 
 /* 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)
-     __nonnull_attribute__ (2);
-
-/* Return end address of function.  */
-extern int dwarf_func_highpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
-     __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);
+/* 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 function.  */
-extern int dwarf_func_line (Dwarf_Func *func, int *linep)
+/* Get line number of beginning of given declaration.  */
+extern int dwarf_decl_line (Dwarf_Die *decl, int *linep)
      __nonnull_attribute__ (2);
 
-/* Get column number of beginning of given function.  */
-extern int dwarf_func_col (Dwarf_Func *func, int *colp)
+/* Get column number of beginning of given declaration.  */
+extern int dwarf_decl_column (Dwarf_Die *decl, 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);
 
index 3849b32048d48678480f27dd96acfaa2a0375d0c..493df48e78b0716b8627555f2b8705e582b3f95d 100644 (file)
@@ -3,10 +3,9 @@ ELFUTILS_0.116 {
   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 @@ ELFUTILS_0.116 {
     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 @@ ELFUTILS_0.116 {
     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 @@ ELFUTILS_0.116 {
     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 @@ ELFUTILS_0.116 {
     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 @@ ELFUTILS_0.116 {
     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;
index 4dbe77e368bc897e5fc646a9f0f9b2e662fdfb63..436287d80db00f70561a2d7531ea8d1bcb110abf 100644 (file)
 #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 @@ struct Dwarf_CU
   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 @@ extern unsigned char *__libdw_find_attr (Dwarf_Die *die,
      __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.  */
index 4139c7d9894bb36b1a1df37a71ca81dcf99846e8..2f7ba0f7e1d251cb8561430e955b5ca5346f504e 100644 (file)
@@ -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.
index 66e0b21b961f59e197cff825e535f7d972e97a20..d4d66be6087f00fdd7456c9212f8f19ec1f19142 100644 (file)
--- a/src/nm.c
+++ b/src/nm.c
@@ -582,9 +582,9 @@ get_var_range (Dwarf_Die *die, Dwarf_Word *lowpc, Dwarf_Word *highpc)
   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.  */
index 37da62c631a0a854d20afca4c2267fb9efc2c396..aa6d650d7ff70940f8d5222fb7bc0425237b4183 100644 (file)
@@ -1,3 +1,10 @@
+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.
index 147ebc2cf29616be9302e90bef99599c05bd9a0d..f414983cbf8b07ec1d087114b5c290ae12644699 100644 (file)
@@ -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);
 
index 5155f6cb6b90b3085bb5616c030fafd077c8e5c9..77d437aac5eb1f08e0f67d39966df2b16c8d70e5 100644 (file)
@@ -100,21 +100,21 @@ print_instance (Dwarf_Die *instance, void *arg)
 }
 
 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 @@ print_func (Dwarf_Func *func, void *arg)
   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));
index 30404cdace38c60b2c9e614513131e0c8e164148..0a2e86e0d80d2ef92827491f3ede51ecff8c2982 100644 (file)
@@ -35,11 +35,11 @@ struct args
 };
 
 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 @@ handle_function (Dwarf_Func *func, void *arg)
        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
index a74e8d87b34da80e8b82e4d764c733d0bc25fa23..3318f311f1674a51ddde1b8e211038fa41655dbf 100644 (file)
@@ -98,11 +98,11 @@ struct args
 };
 
 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 @@ handle_function (Dwarf_Func *func, void *arg)
        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)