Minor re-arrangement to serve the needs for perf 3.12.0

Change-Id: I063c8bcadb70c94336c557be99e2cf4cf6e1b6a2
diff --git a/elfutils/libdw.h b/elfutils/libdw.h
new file mode 100644
index 0000000..3f3e5a0
--- /dev/null
+++ b/elfutils/libdw.h
@@ -0,0 +1,665 @@
+/* Interfaces for libdw.
+   Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   In addition, as a special exception, Red Hat, Inc. gives You the
+   additional right to link the code of Red Hat elfutils with code licensed
+   under any Open Source Initiative certified open source license
+   (http://www.opensource.org/licenses/index.php) which requires the
+   distribution of source code with any binary distribution and to
+   distribute linked combinations of the two.  Non-GPL Code permitted under
+   this exception must only link to the code of Red Hat elfutils through
+   those well defined interfaces identified in the file named EXCEPTION
+   found in the source code files (the "Approved Interfaces").  The files
+   of Non-GPL Code may instantiate templates or use macros or inline
+   functions from the Approved Interfaces without causing the resulting
+   work to be covered by the GNU General Public License.  Only Red Hat,
+   Inc. may make changes or additions to the list of Approved Interfaces.
+   Red Hat's grant of this exception is conditioned upon your not adding
+   any new exceptions.  If you wish to add a new Approved Interface or
+   exception, please contact Red Hat.  You must obey the GNU General Public
+   License in all respects for all of the Red Hat elfutils code and other
+   code used in conjunction with Red Hat elfutils except the Non-GPL Code
+   covered by this exception.  If you modify this file, you may extend this
+   exception to your version of the file, but you are not obligated to do
+   so.  If you do not wish to provide this exception without modification,
+   you must delete this exception statement from your version and license
+   this file solely under the GPL without exception.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifndef _LIBDW_H
+#define _LIBDW_H	1
+
+#include <gelf.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+# define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
+# define __deprecated_attribute__ __attribute__ ((__deprecated__))
+#else
+# define __nonnull_attribute__(args...)
+# define __deprecated_attribute__
+#endif
+
+
+#ifdef __GNUC_STDC_INLINE__
+# define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__))
+#else
+# define __libdw_extern_inline extern __inline
+#endif
+
+
+/* Mode for the session.  */
+typedef enum
+  {
+    DWARF_C_READ,		/* Read .. */
+    DWARF_C_RDWR,		/* Read and write .. */
+    DWARF_C_WRITE,		/* Write .. */
+  }
+Dwarf_Cmd;
+
+
+/* Callback results.  */
+enum
+{
+  DWARF_CB_OK = 0,
+  DWARF_CB_ABORT
+};
+
+
+/* Error values.  */
+enum
+  {
+    DW_TAG_invalid = 0
+#define DW_TAG_invalid	DW_TAG_invalid
+  };
+
+
+/* Type for offset in DWARF file.  */
+typedef GElf_Off Dwarf_Off;
+
+/* Type for address in DWARF file.  */
+typedef GElf_Addr Dwarf_Addr;
+
+/* Integer types.  Big enough to hold any numeric value.  */
+typedef GElf_Xword Dwarf_Word;
+typedef GElf_Sxword Dwarf_Sword;
+/* For the times we know we do not need that much.  */
+typedef GElf_Half Dwarf_Half;
+
+
+/* DWARF abbreviation record.  */
+typedef struct Dwarf_Abbrev Dwarf_Abbrev;
+
+/* Returned to show the last DIE has be returned.  */
+#define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l)
+
+/* Source code line information for CU.  */
+typedef struct Dwarf_Lines_s Dwarf_Lines;
+
+/* One source code line information.  */
+typedef struct Dwarf_Line_s Dwarf_Line;
+
+/* Source file information.  */
+typedef struct Dwarf_Files_s Dwarf_Files;
+
+/* One address range record.  */
+typedef struct Dwarf_Arange_s Dwarf_Arange;
+
+/* Address ranges of a file.  */
+typedef struct Dwarf_Aranges_s Dwarf_Aranges;
+
+/* CU representation.  */
+struct Dwarf_CU;
+
+/* Macro information.  */
+typedef struct Dwarf_Macro_s Dwarf_Macro;
+
+/* Attribute representation.  */
+typedef struct
+{
+  unsigned int code;
+  unsigned int form;
+  unsigned char *valp;
+  struct Dwarf_CU *cu;
+} Dwarf_Attribute;
+
+
+/* Data block representation.  */
+typedef struct
+{
+  Dwarf_Word length;
+  unsigned char *data;
+} Dwarf_Block;
+
+
+/* DIE information.  */
+typedef struct
+{
+  /* The offset can be computed from the address.  */
+  void *addr;
+  struct Dwarf_CU *cu;
+  Dwarf_Abbrev *abbrev;
+  // XXX We'll see what other information will be needed.
+  long int padding__;
+} Dwarf_Die;
+
+/* Returned to show the last DIE has be returned.  */
+#define DWARF_END_DIE ((Dwarf_Die *) -1l)
+
+
+/* Global symbol information.  */
+typedef struct
+{
+  Dwarf_Off cu_offset;
+  Dwarf_Off die_offset;
+  const char *name;
+} Dwarf_Global;
+
+
+/* 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_Op;
+
+
+/* Handle for debug sessions.  */
+typedef struct Dwarf Dwarf;
+
+
+/* Out-Of-Memory handler.  */
+#if __GNUC__ < 4
+typedef void (*Dwarf_OOM) (void);
+#else
+typedef void (*__attribute__ ((noreturn)) Dwarf_OOM) (void);
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Create a handle for a new debug session.  */
+extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd);
+
+/* Create a handle for a new debug session for an ELF file.  */
+extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp);
+
+/* Retrieve ELF descriptor used for DWARF access.  */
+extern Elf *dwarf_getelf (Dwarf *dwarf);
+
+/* Release debugging handling context.  */
+extern int dwarf_end (Dwarf *dwarf);
+
+
+/* Get the data block for the .debug_info section.  */
+extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf);
+
+/* Read the header for the DWARF CU header.  */
+extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
+			 size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
+			 uint8_t *address_sizep, uint8_t *offset_sizep)
+     __nonnull_attribute__ (3);
+
+
+/* Return DIE at given offset.  */
+extern Dwarf_Die *dwarf_offdie (Dwarf *dbg, Dwarf_Off offset,
+				Dwarf_Die *result) __nonnull_attribute__ (3);
+
+/* Return offset of DIE.  */
+extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die);
+
+/* Return offset of DIE in CU.  */
+extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die);
+
+/* Return CU DIE containing given DIE.  */
+extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result,
+			       uint8_t *address_sizep, uint8_t *offset_sizep)
+     __nonnull_attribute__ (2);
+
+/* Return CU DIE containing given address.  */
+extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
+				 Dwarf_Die *result) __nonnull_attribute__ (3);
+
+/* Return child of current DIE.  */
+extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
+     __nonnull_attribute__ (2);
+
+/* Locates the first sibling of DIE and places it in RESULT.
+   Returns 0 if a sibling was found, -1 if something went wrong.
+   Returns 1 if no sibling could be found and, if RESULT is not
+   the same as DIE, it sets RESULT->addr to the address of the
+   (non-sibling) DIE that follows this one, or NULL if this DIE
+   was the last one in the cokmpilation unit.  */
+extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
+     __nonnull_attribute__ (2);
+
+/* Check whether the DIE has children.  */
+extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1);
+
+/* Walks the attributes of DIE, starting at the one OFFSET bytes in,
+   calling the CALLBACK function for each one.  Stops if the callback
+   function ever returns a value other than DWARF_CB_OK and returns the
+   offset of the offending attribute.  If the end of the attributes
+   is reached 1 is returned.  If something goes wrong -1 is returned and
+   the dwarf error number is set.  */
+extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die,
+				 int (*callback) (Dwarf_Attribute *, void *),
+				 void *arg, ptrdiff_t offset)
+     __nonnull_attribute__ (2);
+
+/* Return tag of given DIE.  */
+extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1);
+
+
+/* Return specific attribute of DIE.  */
+extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name,
+				    Dwarf_Attribute *result)
+     __nonnull_attribute__ (3);
+
+/* Check whether given DIE has specific attribute.  */
+extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
+
+/* These are the same as dwarf_attr and dwarf_hasattr, respectively,
+   but they resolve an indirect attribute through DW_AT_abstract_origin.  */
+extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
+					      unsigned int search_name,
+					      Dwarf_Attribute *result)
+     __nonnull_attribute__ (3);
+extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name);
+
+
+
+
+/* Check whether given attribute has specific form.  */
+extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form);
+
+/* Return attribute code of given attribute.  */
+extern unsigned int dwarf_whatattr (Dwarf_Attribute *attr);
+
+/* Return form code of given attribute.  */
+extern unsigned int dwarf_whatform (Dwarf_Attribute *attr);
+
+
+/* Return string associated with given attribute.  */
+extern const char *dwarf_formstring (Dwarf_Attribute *attrp);
+
+/* Return unsigned constant represented by attribute.  */
+extern int dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
+     __nonnull_attribute__ (2);
+
+/* Return signed constant represented by attribute.  */
+extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval)
+     __nonnull_attribute__ (2);
+
+/* Return address represented by attribute.  */
+extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr)
+     __nonnull_attribute__ (2);
+
+/* This function is deprecated.  Always use dwarf_formref_die instead.
+   Return reference offset represented by attribute.  */
+extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
+     __nonnull_attribute__ (2) __deprecated_attribute__;
+
+/* Look up the DIE in a reference-form attribute.  */
+extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem)
+     __nonnull_attribute__ (2);
+
+/* Return block represented by attribute.  */
+extern int dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block)
+     __nonnull_attribute__ (2);
+
+/* Return flag represented by attribute.  */
+extern int dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool)
+     __nonnull_attribute__ (2);
+
+
+/* Simplified attribute value access functions.  */
+
+/* Return string in name attribute of DIE.  */
+extern const char *dwarf_diename (Dwarf_Die *die);
+
+/* Return high PC attribute of DIE.  */
+extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
+     __nonnull_attribute__ (2);
+
+/* Return low PC attribute of DIE.  */
+extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
+     __nonnull_attribute__ (2);
+
+/* Return entry_pc or low_pc attribute of DIE.  */
+extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
+     __nonnull_attribute__ (2);
+
+/* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address,
+   0 if not, or -1 for errors.  */
+extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc);
+
+/* Enumerate the PC address ranges covered by this DIE, covering all
+   addresses where dwarf_haspc returns true.  In the first call OFFSET
+   should be zero and *BASEP need not be initialized.  Returns -1 for
+   errors, zero when there are no more address ranges to report, or a
+   nonzero OFFSET value to pass to the next call.  Each subsequent call
+   must preserve *BASEP from the prior call.  Successful calls fill in
+   *STARTP and *ENDP with a contiguous address range.  */
+extern ptrdiff_t dwarf_ranges (Dwarf_Die *die,
+			       ptrdiff_t offset, Dwarf_Addr *basep,
+			       Dwarf_Addr *startp, Dwarf_Addr *endp);
+
+
+/* Return byte size attribute of DIE.  */
+extern int dwarf_bytesize (Dwarf_Die *die);
+
+/* Return bit size attribute of DIE.  */
+extern int dwarf_bitsize (Dwarf_Die *die);
+
+/* Return bit offset attribute of DIE.  */
+extern int dwarf_bitoffset (Dwarf_Die *die);
+
+/* Return array order attribute of DIE.  */
+extern int dwarf_arrayorder (Dwarf_Die *die);
+
+/* Return source language attribute of DIE.  */
+extern int dwarf_srclang (Dwarf_Die *die);
+
+
+/* Get abbreviation at given offset for given DIE.  */
+extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset,
+				      size_t *lengthp);
+
+/* Get abbreviation at given offset in .debug_abbrev section.  */
+extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
+			    Dwarf_Abbrev *abbrevp)
+     __nonnull_attribute__ (4);
+
+/* Get abbreviation code.  */
+extern unsigned int dwarf_getabbrevcode (Dwarf_Abbrev *abbrev);
+
+/* Get abbreviation tag.  */
+extern unsigned int dwarf_getabbrevtag (Dwarf_Abbrev *abbrev);
+
+/* Return true if abbreviation is children flag set.  */
+extern int dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev);
+
+/* Get number of attributes of abbreviation.  */
+extern int dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp)
+     __nonnull_attribute__ (2);
+
+/* Get specific attribute of abbreviation.  */
+extern int dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx,
+				unsigned int *namep, unsigned int *formp,
+				Dwarf_Off *offset);
+
+
+/* Get string from-debug_str section.  */
+extern const char *dwarf_getstring (Dwarf *dbg, Dwarf_Off offset,
+				    size_t *lenp);
+
+
+/* Get public symbol information.  */
+extern ptrdiff_t dwarf_getpubnames (Dwarf *dbg,
+				    int (*callback) (Dwarf *, Dwarf_Global *,
+						     void *),
+				    void *arg, ptrdiff_t offset)
+     __nonnull_attribute__ (2);
+
+
+/* Get source file information for CU.  */
+extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
+			      size_t *nlines) __nonnull_attribute__ (2, 3);
+
+/* Return one of the source lines of the CU.  */
+extern Dwarf_Line *dwarf_onesrcline (Dwarf_Lines *lines, size_t idx);
+
+/* Get the file source files used in the CU.  */
+extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files,
+			      size_t *nfiles)
+     __nonnull_attribute__ (2);
+
+
+/* Get source for address in CU.  */
+extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr);
+
+/* Get source for file and line number.  */
+extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col,
+			      Dwarf_Line ***srcsp, size_t *nsrcs)
+     __nonnull_attribute__ (2, 5, 6);
+
+
+/* Return line address.  */
+extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp);
+
+/* Return line number.  */
+extern int dwarf_lineno (Dwarf_Line *line, int *linep)
+     __nonnull_attribute__ (2);
+
+/* Return column in line.  */
+extern int dwarf_linecol (Dwarf_Line *line, int *colp)
+     __nonnull_attribute__ (2);
+
+/* Return true if record is for beginning of a statement.  */
+extern int dwarf_linebeginstatement (Dwarf_Line *line, bool *flagp)
+     __nonnull_attribute__ (2);
+
+/* Return true if record is for end of sequence.  */
+extern int dwarf_lineendsequence (Dwarf_Line *line, bool *flagp)
+     __nonnull_attribute__ (2);
+
+/* Return true if record is for beginning of a basic block.  */
+extern int dwarf_lineblock (Dwarf_Line *line, bool *flagp)
+     __nonnull_attribute__ (2);
+
+/* Return true if record is for end of prologue.  */
+extern int dwarf_lineprologueend (Dwarf_Line *line, bool *flagp)
+     __nonnull_attribute__ (2);
+
+/* Return true if record is for beginning of epilogue.  */
+extern int dwarf_lineepiloguebegin (Dwarf_Line *line, bool *flagp)
+     __nonnull_attribute__ (2);
+
+
+/* Find line information for address.  */
+extern const char *dwarf_linesrc (Dwarf_Line *line,
+				  Dwarf_Word *mtime, Dwarf_Word *length);
+
+/* Return file information.  */
+extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx,
+				  Dwarf_Word *mtime, Dwarf_Word *length);
+
+/* Return the directory list used in the file information extracted.
+   (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null.
+   (*RESULT)[0..*NDIRS-1] are the compile-time include directory path
+   encoded by the compiler.  */
+extern int dwarf_getsrcdirs (Dwarf_Files *files,
+			     const char *const **result, size_t *ndirs)
+  __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 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.  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.
+   Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
+   and returns the number of elements in the array.
+   (*SCOPES)[0] is the DIE for the innermost scope containing PC,
+   (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
+   Returns -1 for errors or 0 if no scopes match PC.  */
+extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc,
+			    Dwarf_Die **scopes);
+
+/* Return scope DIEs containing the given DIE.
+   Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
+   and returns the number of elements in the array.
+   (*SCOPES)[0] is a copy of DIE.
+   (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
+   Returns -1 for errors or 0 if DIE is not found in any scope entry.  */
+extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes);
+
+
+/* Search SCOPES[0..NSCOPES-1] for a variable called NAME.
+   Ignore the first SKIP_SHADOWS scopes that match the name.
+   If MATCH_FILE is not null, accept only declaration in that source file;
+   if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration
+   at that line and column.
+
+   If successful, fill in *RESULT with the DIE of the variable found,
+   and return N where SCOPES[N] is the scope defining the variable.
+   Return -1 for errors or -2 for no matching variable found.  */
+extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
+			      const char *name, int skip_shadows,
+			      const char *match_file,
+			      int match_lineno, int match_linecol,
+			      Dwarf_Die *result);
+
+
+
+/* Return list address ranges.  */
+extern int dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges,
+			     size_t *naranges)
+     __nonnull_attribute__ (2);
+
+/* Return one of the address range entries.  */
+extern Dwarf_Arange *dwarf_onearange (Dwarf_Aranges *aranges, size_t idx);
+
+/* Return information in address range record.  */
+extern int dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp,
+				Dwarf_Word *lengthp, Dwarf_Off *offsetp);
+
+/* Get address range which includes given address.  */
+extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
+					   Dwarf_Addr addr);
+
+
+
+/* Get functions in CUDIE.  */
+extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
+				 int (*callback) (Dwarf_Die *, void *),
+				 void *arg, ptrdiff_t offset);
+
+
+/* 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);
+
+/* Get column number of beginning of given declaration.  */
+extern int dwarf_decl_column (Dwarf_Die *decl, int *colp)
+     __nonnull_attribute__ (2);
+
+
+/* Return nonzero if given function is an abstract inline definition.  */
+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_Die *func,
+					int (*callback) (Dwarf_Die *, void *),
+					void *arg);
+
+
+/* Find the appropriate PC location or locations for function entry
+   breakpoints for the given DW_TAG_subprogram DIE.  Returns -1 for errors.
+   On success, returns the number of breakpoint locations (never zero)
+   and sets *BKPTS to a malloc'd vector of addresses.  */
+extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts);
+
+
+/* Call callback function for each of the macro information entry for
+   the CU.  */
+extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie,
+				  int (*callback) (Dwarf_Macro *, void *),
+				  void *arg, ptrdiff_t offset)
+     __nonnull_attribute__ (2);
+
+/* Return macro opcode.  */
+extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep)
+     __nonnull_attribute__ (2);
+
+/* Return first macro parameter.  */
+extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
+     __nonnull_attribute__ (2);
+
+/* Return second macro parameter.  */
+extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp,
+			       const char **strp);
+
+
+/* Return error code of last failing function call.  This value is kept
+   separately for each thread.  */
+extern int dwarf_errno (void);
+
+/* Return error string for ERROR.  If ERROR is zero, return error string
+   for most recent error or NULL is none occurred.  If ERROR is -1 the
+   behaviour is similar to the last case except that not NULL but a legal
+   string is returned.  */
+extern const char *dwarf_errmsg (int err);
+
+
+/* Register new Out-Of-Memory handler.  The old handler is returned.  */
+extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
+
+
+/* Inline optimizations.  */
+#ifdef __OPTIMIZE__
+/* Return attribute code of given attribute.  */
+__libdw_extern_inline unsigned int
+dwarf_whatattr (Dwarf_Attribute *attr)
+{
+  return attr == NULL ? 0 : attr->code;
+}
+
+/* Return attribute code of given attribute.  */
+__libdw_extern_inline unsigned int
+dwarf_whatform (Dwarf_Attribute *attr)
+{
+  return attr == NULL ? 0 : attr->form;
+}
+#endif	/* Optimize.  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* libdw.h */
diff --git a/elfutils/libdwfl.h b/elfutils/libdwfl.h
new file mode 100644
index 0000000..b6ae776
--- /dev/null
+++ b/elfutils/libdwfl.h
@@ -0,0 +1,558 @@
+/* Interfaces for libdwfl.
+   Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   In addition, as a special exception, Red Hat, Inc. gives You the
+   additional right to link the code of Red Hat elfutils with code licensed
+   under any Open Source Initiative certified open source license
+   (http://www.opensource.org/licenses/index.php) which requires the
+   distribution of source code with any binary distribution and to
+   distribute linked combinations of the two.  Non-GPL Code permitted under
+   this exception must only link to the code of Red Hat elfutils through
+   those well defined interfaces identified in the file named EXCEPTION
+   found in the source code files (the "Approved Interfaces").  The files
+   of Non-GPL Code may instantiate templates or use macros or inline
+   functions from the Approved Interfaces without causing the resulting
+   work to be covered by the GNU General Public License.  Only Red Hat,
+   Inc. may make changes or additions to the list of Approved Interfaces.
+   Red Hat's grant of this exception is conditioned upon your not adding
+   any new exceptions.  If you wish to add a new Approved Interface or
+   exception, please contact Red Hat.  You must obey the GNU General Public
+   License in all respects for all of the Red Hat elfutils code and other
+   code used in conjunction with Red Hat elfutils except the Non-GPL Code
+   covered by this exception.  If you modify this file, you may extend this
+   exception to your version of the file, but you are not obligated to do
+   so.  If you do not wish to provide this exception without modification,
+   you must delete this exception statement from your version and license
+   this file solely under the GPL without exception.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifndef _LIBDWFL_H
+#define _LIBDWFL_H	1
+
+#include "libdw.h"
+#include <stdio.h>
+
+/* Handle for a session using the library.  */
+typedef struct Dwfl Dwfl;
+
+/* Handle for a module.  */
+typedef struct Dwfl_Module Dwfl_Module;
+
+/* Handle describing a line record.  */
+typedef struct Dwfl_Line Dwfl_Line;
+
+/* Callbacks.  */
+typedef struct
+{
+  int (*find_elf) (Dwfl_Module *mod, void **userdata,
+		   const char *modname, Dwarf_Addr base,
+		   char **file_name, Elf **elfp);
+
+  int (*find_debuginfo) (Dwfl_Module *mod, void **userdata,
+			 const char *modname, Dwarf_Addr base,
+			 const char *file_name,
+			 const char *debuglink_file, GElf_Word debuglink_crc,
+			 char **debuginfo_file_name);
+
+  /* Fill *ADDR with the loaded address of the section called SECNAME in
+     the given module.  Use (Dwarf_Addr) -1 if this section is omitted from
+     accessible memory.  This is called exactly once for each SHF_ALLOC
+     section that relocations affecting DWARF data refer to, so it can
+     easily be used to collect state about the sections referenced.  */
+  int (*section_address) (Dwfl_Module *mod, void **userdata,
+			  const char *modname, Dwarf_Addr base,
+			  const char *secname,
+			  GElf_Word shndx, const GElf_Shdr *shdr,
+			  Dwarf_Addr *addr);
+
+  char **debuginfo_path;	/* See dwfl_standard_find_debuginfo.  */
+} Dwfl_Callbacks;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Start a new session with the library.  */
+extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks)
+  __nonnull_attribute__ (1);
+
+
+/* End a session.  */
+extern void dwfl_end (Dwfl *);
+
+/* Return implementation's version string suitable for printing.  */
+extern const char *dwfl_version (Dwfl *);
+
+/* Return error code of last failing function call.  This value is kept
+   separately for each thread.  */
+extern int dwfl_errno (void);
+
+/* Return error string for ERROR.  If ERROR is zero, return error string
+   for most recent error or NULL if none occurred.  If ERROR is -1 the
+   behaviour is similar to the last case except that not NULL but a legal
+   string is returned.  */
+extern const char *dwfl_errmsg (int err);
+
+
+/* Start reporting the current set of segments and modules to the library.
+   All existing segments are wiped.  Existing modules are marked to be
+   deleted, and will not be found via dwfl_addrmodule et al if they are not
+   re-reported before dwfl_report_end is called.  */
+extern void dwfl_report_begin (Dwfl *dwfl);
+
+/* Report that segment NDX begins at PHDR->p_vaddr + BIAS.
+   If NDX is < 0, the value succeeding the last call's NDX
+   is used instead (zero on the first call).
+
+   If nonzero, the smallest PHDR->p_align value seen sets the
+   effective page size for the address space DWFL describes.
+   This is the granularity at which reported module boundary
+   addresses will be considered to fall in or out of a segment.
+
+   Returns -1 for errors, or NDX (or its assigned replacement) on success.
+
+   When NDX is the value succeeding the last call's NDX (or is implicitly
+   so as above), IDENT is nonnull and matches the value in the last call,
+   and the PHDR and BIAS values reflect a segment that would be contiguous,
+   in both memory and file, with the last segment reported, then this
+   segment may be coalesced internally with preceding segments.  When given
+   an address inside this segment, dwfl_addrsegment may return the NDX of a
+   preceding contiguous segment.  To prevent coalesced segments, always
+   pass a null pointer for IDENT.
+
+   The values passed are not stored (except to track coalescence).
+   The only information that can be extracted from DWFL later is the
+   mapping of an address to a segment index that starts at or below
+   it.  Reporting segments at all is optional.  Its only benefit to
+   the caller is to offer this quick lookup via dwfl_addrsegment,
+   or use other segment-based calls.  */
+extern int dwfl_report_segment (Dwfl *dwfl, int ndx,
+				const GElf_Phdr *phdr, GElf_Addr bias,
+				const void *ident);
+
+/* Report that a module called NAME spans addresses [START, END).
+   Returns the module handle, either existing or newly allocated,
+   or returns a null pointer for an allocation error.  */
+extern Dwfl_Module *dwfl_report_module (Dwfl *dwfl, const char *name,
+					Dwarf_Addr start, Dwarf_Addr end);
+
+/* Report a module with start and end addresses computed from the ELF
+   program headers in the given file, plus BASE.  For an ET_REL file,
+   does a simple absolute section layout starting at BASE.
+   FD may be -1 to open FILE_NAME.  On success, FD is consumed by the
+   library, and the `find_elf' callback will not be used for this module.  */
+extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name,
+				     const char *file_name, int fd,
+				     GElf_Addr base);
+
+/* Similar, but report the module for offline use.  All ET_EXEC files
+   being reported must be reported before any relocatable objects.
+   If this is used, dwfl_report_module and dwfl_report_elf may not be
+   used in the same reporting session.  */
+extern Dwfl_Module *dwfl_report_offline (Dwfl *dwfl, const char *name,
+					 const char *file_name, int fd);
+
+
+/* Finish reporting the current set of modules to the library.
+   If REMOVED is not null, it's called for each module that
+   existed before but was not included in the current report.
+   Returns a nonzero return value from the callback.
+   The callback may call dwfl_report_module; doing so with the
+   details of the module being removed prevents its removal.
+   DWFL cannot be used until this function has returned zero.  */
+extern int dwfl_report_end (Dwfl *dwfl,
+			    int (*removed) (Dwfl_Module *, void *,
+					    const char *, Dwarf_Addr,
+					    void *arg),
+			    void *arg);
+
+/* Start reporting additional modules to the library.  No calls but
+   dwfl_report_* can be made on DWFL until dwfl_report_end is called.
+   This is like dwfl_report_begin, but all the old modules are kept on.
+   More dwfl_report_* calls can follow to add more modules.
+   When dwfl_report_end is called, no old modules will be removed.  */
+extern void dwfl_report_begin_add (Dwfl *dwfl);
+
+
+/* Return the name of the module, and for each non-null argument store
+   interesting details: *USERDATA is a location for storing your own
+   pointer, **USERDATA is initially null; *START and *END give the address
+   range covered by the module; *DWBIAS is the address bias for debugging
+   information, and *SYMBIAS for symbol table entries (either is -1 if not
+   yet accessed); *MAINFILE is the name of the ELF file, and *DEBUGFILE the
+   name of the debuginfo file (might be equal to *MAINFILE; either is null
+   if not yet accessed).  */
+extern const char *dwfl_module_info (Dwfl_Module *mod, void ***userdata,
+				     Dwarf_Addr *start, Dwarf_Addr *end,
+				     Dwarf_Addr *dwbias, Dwarf_Addr *symbias,
+				     const char **mainfile,
+				     const char **debugfile);
+
+/* Iterate through the modules, starting the walk with OFFSET == 0.
+   Calls *CALLBACK for each module as long as it returns DWARF_CB_OK.
+   When *CALLBACK returns another value, the walk stops and the
+   return value can be passed as OFFSET to resume it.  Returns 0 when
+   there are no more modules, or -1 for errors.  */
+extern ptrdiff_t dwfl_getmodules (Dwfl *dwfl,
+				  int (*callback) (Dwfl_Module *, void **,
+						   const char *, Dwarf_Addr,
+						   void *arg),
+				  void *arg,
+				  ptrdiff_t offset);
+
+/* Find the module containing the given address.  */
+extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address);
+
+/* Find the segment, if any, and module, if any, containing ADDRESS.
+   Returns a segment index returned by dwfl_report_segment, or -1
+   if no segment matches the address.  Regardless of the return value,
+   *MOD is always set to the module containing ADDRESS, or to null.  */
+extern int dwfl_addrsegment (Dwfl *dwfl, Dwarf_Addr address, Dwfl_Module **mod);
+
+
+
+/* Report the known build ID bits associated with a module.
+   If VADDR is nonzero, it gives the absolute address where those
+   bits are found within the module.  This can be called at any
+   time, but is usually used immediately after dwfl_report_module.
+   Once the module's main ELF file is opened, the ID note found
+   there takes precedence and cannot be changed.  */
+extern int dwfl_module_report_build_id (Dwfl_Module *mod,
+					const unsigned char *bits, size_t len,
+					GElf_Addr vaddr)
+  __nonnull_attribute__ (2);
+
+/* Extract the build ID bits associated with a module.
+   Returns -1 for errors, 0 if no ID is known, or the number of ID bytes.
+   When an ID is found, *BITS points to it; *VADDR is the absolute address
+   at which the ID bits are found within the module, or 0 if unknown.
+
+   This returns 0 when the module's main ELF file has not yet been loaded
+   and its build ID bits were not reported.  To ensure the ID is always
+   returned when determinable, call dwfl_module_getelf first.  */
+extern int dwfl_module_build_id (Dwfl_Module *mod,
+				 const unsigned char **bits, GElf_Addr *vaddr)
+  __nonnull_attribute__ (2, 3);
+
+
+/*** Standard callbacks ***/
+
+/* These standard find_elf and find_debuginfo callbacks are
+   controlled by a string specifying directories to look in.
+   If `debuginfo_path' is set in the Dwfl_Callbacks structure
+   and the char * it points to is not null, that supplies the
+   string.  Otherwise a default path is used.
+
+   If the first character of the string is + or - that enables or
+   disables CRC32 checksum validation when it's necessary.  The
+   remainder of the string is composed of elements separated by
+   colons.  Each element can start with + or - to override the
+   global checksum behavior.  This flag is never relevant when
+   working with build IDs, but it's always parsed in the path
+   string.  The remainder of the element indicates a directory.
+
+   Searches by build ID consult only the elements naming absolute
+   directory paths.  They look under those directories for a link
+   named ".build-id/xx/yy" or ".build-id/xx/yy.debug", where "xxyy"
+   is the lower-case hexadecimal representation of the ID bytes.
+
+   In searches for debuginfo by name, if the remainder of the
+   element is empty, the directory containing the main file is
+   tried; if it's an absolute path name, the absolute directory path
+   containing the main file is taken as a subdirectory of this path;
+   a relative path name is taken as a subdirectory of the directory
+   containing the main file.  Hence for /bin/ls, the default string
+   ":.debug:/usr/lib/debug" says to look in /bin, then /bin/.debug,
+   then /usr/lib/debug/bin, for the file name in the .gnu_debuglink
+   section (or "ls.debug" if none was found).  */
+
+/* Standard find_elf callback function working solely on build ID.
+   This can be tried first by any find_elf callback, to use the
+   bits passed to dwfl_module_report_build_id, if any.  */
+extern int dwfl_build_id_find_elf (Dwfl_Module *, void **,
+				   const char *, Dwarf_Addr,
+				   char **, Elf **);
+
+/* Standard find_debuginfo callback function working solely on build ID.
+   This can be tried first by any find_debuginfo callback,
+   to use the build ID bits from the main file when present.  */
+extern int dwfl_build_id_find_debuginfo (Dwfl_Module *, void **,
+					 const char *, Dwarf_Addr,
+					 const char *, const char *,
+					 GElf_Word, char **);
+
+/* Standard find_debuginfo callback function.
+   If a build ID is available, this tries first to use that.
+   If there is no build ID or no valid debuginfo found by ID,
+   it searches the debuginfo path by name, as described above.
+   Any file found in the path is validated by build ID if possible,
+   or else by CRC32 checksum if enabled, and skipped if it does not match.  */
+extern int dwfl_standard_find_debuginfo (Dwfl_Module *, void **,
+					 const char *, Dwarf_Addr,
+					 const char *, const char *,
+					 GElf_Word, char **);
+
+
+/* This callback must be used when using dwfl_offline_* to report modules,
+   if ET_REL is to be supported.  */
+extern int dwfl_offline_section_address (Dwfl_Module *, void **,
+					 const char *, Dwarf_Addr,
+					 const char *, GElf_Word,
+					 const GElf_Shdr *,
+					 Dwarf_Addr *addr);
+
+
+/* Callbacks for working with kernel modules in the running Linux kernel.  */
+extern int dwfl_linux_kernel_find_elf (Dwfl_Module *, void **,
+				       const char *, Dwarf_Addr,
+				       char **, Elf **);
+extern int dwfl_linux_kernel_module_section_address (Dwfl_Module *, void **,
+						     const char *, Dwarf_Addr,
+						     const char *, GElf_Word,
+						     const GElf_Shdr *,
+						     Dwarf_Addr *addr);
+
+/* Call dwfl_report_elf for the running Linux kernel.
+   Returns zero on success, -1 if dwfl_report_module failed,
+   or an errno code if opening the kernel binary failed.  */
+extern int dwfl_linux_kernel_report_kernel (Dwfl *dwfl);
+
+/* Call dwfl_report_module for each kernel module in the running Linux kernel.
+   Returns zero on success, -1 if dwfl_report_module failed,
+   or an errno code if reading the list of modules failed.  */
+extern int dwfl_linux_kernel_report_modules (Dwfl *dwfl);
+
+/* Report a kernel and its modules found on disk, for offline use.
+   If RELEASE starts with '/', it names a directory to look in;
+   if not, it names a directory to find under /lib/modules/;
+   if null, /lib/modules/`uname -r` is used.
+   Returns zero on success, -1 if dwfl_report_module failed,
+   or an errno code if finding the files on disk failed.
+
+   If PREDICATE is not null, it is called with each module to be reported;
+   its arguments are the module name, and the ELF file name or null if unknown,
+   and its return value should be zero to skip the module, one to report it,
+   or -1 to cause the call to fail and return errno.  */
+extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
+					     int (*predicate) (const char *,
+							       const char *));
+
+
+/* Call dwfl_report_module for each file mapped into the address space of PID.
+   Returns zero on success, -1 if dwfl_report_module failed,
+   or an errno code if opening the kernel binary failed.  */
+extern int dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid);
+
+/* Similar, but reads an input stream in the format of Linux /proc/PID/maps
+   files giving module layout, not the file for a live process.  */
+extern int dwfl_linux_proc_maps_report (Dwfl *dwfl, FILE *);
+
+/* Trivial find_elf callback for use with dwfl_linux_proc_report.
+   This uses the module name as a file name directly and tries to open it
+   if it begin with a slash, or handles the magic string "[vdso]".  */
+extern int dwfl_linux_proc_find_elf (Dwfl_Module *mod, void **userdata,
+				     const char *module_name, Dwarf_Addr base,
+				     char **file_name, Elf **);
+
+/* Standard argument parsing for using a standard callback set.  */
+struct argp;
+extern const struct argp *dwfl_standard_argp (void) __attribute__ ((const));
+
+
+/*** Relocation of addresses from Dwfl ***/
+
+/* Return the number of relocatable bases associated with the module,
+   which is zero for ET_EXEC and one for ET_DYN.  Returns -1 for errors.  */
+extern int dwfl_module_relocations (Dwfl_Module *mod);
+
+/* Return the relocation base index associated with the *ADDRESS location,
+   and adjust *ADDRESS to be an offset relative to that base.
+   Returns -1 for errors.  */
+extern int dwfl_module_relocate_address (Dwfl_Module *mod,
+					 Dwarf_Addr *address);
+
+/* Return the ELF section name for the given relocation base index;
+   if SHNDXP is not null, set *SHNDXP to the ELF section index.
+   For ET_DYN, returns "" and sets *SHNDXP to SHN_ABS; the relocation
+   base is the runtime start address reported for the module.
+   Returns null for errors.  */
+extern const char *dwfl_module_relocation_info (Dwfl_Module *mod,
+						unsigned int idx,
+						GElf_Word *shndxp);
+
+/* Validate that ADDRESS and ADDRESS+OFFSET lie in a known module
+   and both within the same contiguous region for relocation purposes.
+   Returns zero for success and -1 for errors.  */
+extern int dwfl_validate_address (Dwfl *dwfl,
+				  Dwarf_Addr address, Dwarf_Sword offset);
+
+
+/*** ELF access functions ***/
+
+/* Fetch the module main ELF file (where the allocated sections
+   are found) for use with libelf.  If successful, fills in *BIAS
+   with the difference between addresses within the loaded module
+   and those in symbol tables or Dwarf information referring to it.  */
+extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias);
+
+/* Return the number of symbols in the module's symbol table,
+   or -1 for errors.  */
+extern int dwfl_module_getsymtab (Dwfl_Module *mod);
+
+/* Fetch one entry from the module's symbol table.  On errors, returns
+   NULL.  If successful, fills in *SYM and returns the string for st_name.
+   This works like gelf_getsym except that st_value is always adjusted
+   to an absolute value based on the module's location.  If SHNDXP is
+   non-null, it's set with the section index (whether from st_shndx or
+   extended index table).  */
+extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx,
+				       GElf_Sym *sym, GElf_Word *shndxp)
+  __nonnull_attribute__ (3);
+
+/* Find the symbol that ADDRESS lies inside, and return its name.  */
+extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address);
+
+/* Find the symbol that ADDRESS lies inside, and return detailed
+   information as for dwfl_module_getsym (above).  */
+extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address,
+					GElf_Sym *sym, GElf_Word *shndxp)
+  __nonnull_attribute__ (3);
+
+/* Find the ELF section that *ADDRESS lies inside and return it.
+   On success, adjusts *ADDRESS to be relative to the section,
+   and sets *BIAS to the difference between addresses used in
+   the returned section's headers and run-time addresses.  */
+extern Elf_Scn *dwfl_module_address_section (Dwfl_Module *mod,
+					     Dwarf_Addr *address,
+					     Dwarf_Addr *bias)
+  __nonnull_attribute__ (2, 3);
+
+
+/*** Dwarf access functions ***/
+
+/* Fetch the module's debug information for use with libdw.
+   If successful, fills in *BIAS with the difference between
+   addresses within the loaded module and those  to use with libdw.  */
+extern Dwarf *dwfl_module_getdwarf (Dwfl_Module *, Dwarf_Addr *bias)
+     __nonnull_attribute__ (2);
+
+/* Get the libdw handle for each module.  */
+extern ptrdiff_t dwfl_getdwarf (Dwfl *,
+				int (*callback) (Dwfl_Module *, void **,
+						 const char *, Dwarf_Addr,
+						 Dwarf *, Dwarf_Addr, void *),
+				void *arg, ptrdiff_t offset);
+
+/* Look up the module containing ADDR and return its debugging information,
+   loading it if necessary.  */
+extern Dwarf *dwfl_addrdwarf (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias)
+     __nonnull_attribute__ (3);
+
+
+/* Find the CU containing ADDR and return its DIE.  */
+extern Dwarf_Die *dwfl_addrdie (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias)
+     __nonnull_attribute__ (3);
+extern Dwarf_Die *dwfl_module_addrdie (Dwfl_Module *mod,
+				       Dwarf_Addr addr, Dwarf_Addr *bias)
+     __nonnull_attribute__ (3);
+
+/* Iterate through the CUs, start with null for LASTCU.  */
+extern Dwarf_Die *dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias)
+     __nonnull_attribute__ (3);
+extern Dwarf_Die *dwfl_module_nextcu (Dwfl_Module *mod,
+				      Dwarf_Die *lastcu, Dwarf_Addr *bias)
+     __nonnull_attribute__ (3);
+
+/* Return the module containing the CU DIE.  */
+extern Dwfl_Module *dwfl_cumodule (Dwarf_Die *cudie);
+
+
+/* Cache the source line information fo the CU and return the
+   number of Dwfl_Line entries it has.  */
+extern int dwfl_getsrclines (Dwarf_Die *cudie, size_t *nlines);
+
+/* Access one line number entry within the CU.  */
+extern Dwfl_Line *dwfl_onesrcline (Dwarf_Die *cudie, size_t idx);
+
+/* Get source for address.  */
+extern Dwfl_Line *dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr);
+extern Dwfl_Line *dwfl_getsrc (Dwfl *dwfl, Dwarf_Addr addr);
+
+/* Get address for source.  */
+extern int dwfl_module_getsrc_file (Dwfl_Module *mod,
+				    const char *fname, int lineno, int column,
+				    Dwfl_Line ***srcsp, size_t *nsrcs);
+
+/* Return the module containing this line record.  */
+extern Dwfl_Module *dwfl_linemodule (Dwfl_Line *line);
+
+/* Return the CU containing this line record.  */
+extern Dwarf_Die *dwfl_linecu (Dwfl_Line *line);
+
+/* Return the source file name and fill in other information.
+   Arguments may be null for unneeded fields.  */
+extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr,
+				  int *linep, int *colp,
+				  Dwarf_Word *mtime, Dwarf_Word *length);
+
+/* Return the compilation directory (AT_comp_dir) from this line's CU.  */
+extern const char *dwfl_line_comp_dir (Dwfl_Line *line);
+
+
+/*** Machine backend access functions ***/
+
+/* Return location expression to find return value given a
+   DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing
+   function itself (whose DW_AT_type attribute describes its return type).
+   The given DIE must come from the given module.  Returns -1 for errors.
+   Returns zero if the function has no return value (e.g. "void" in C).
+   Otherwise, *LOCOPS gets a location expression to find the return value,
+   and returns the number of operations in the expression.  The pointer is
+   permanently allocated at least as long as the module is live.  */
+extern int dwfl_module_return_value_location (Dwfl_Module *mod,
+					      Dwarf_Die *functypedie,
+					      const Dwarf_Op **locops);
+
+/* Enumerate the DWARF register numbers and their names.
+   For each register, CALLBACK gets its DWARF number, a string describing
+   the register set (such as "integer" or "FPU"), a prefix used in
+   assembler syntax (such as "%" or "$", may be ""), and the name for the
+   register (contains identifier characters only, possibly all digits).
+   The REGNAME string is valid only during the callback. */
+extern int dwfl_module_register_names (Dwfl_Module *mod,
+				       int (*callback) (void *arg,
+							int regno,
+							const char *setname,
+							const char *prefix,
+							const char *regname,
+							int bits, int type),
+				       void *arg);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* libdwfl.h */
diff --git a/elfutils/version.h b/elfutils/version.h
new file mode 100644
index 0000000..d166419
--- /dev/null
+++ b/elfutils/version.h
@@ -0,0 +1,58 @@
+/* Version information about elfutils development libraries.
+   Copyright (C) 2008 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   In addition, as a special exception, Red Hat, Inc. gives You the
+   additional right to link the code of Red Hat elfutils with code licensed
+   under any Open Source Initiative certified open source license
+   (http://www.opensource.org/licenses/index.php) which requires the
+   distribution of source code with any binary distribution and to
+   distribute linked combinations of the two.  Non-GPL Code permitted under
+   this exception must only link to the code of Red Hat elfutils through
+   those well defined interfaces identified in the file named EXCEPTION
+   found in the source code files (the "Approved Interfaces").  The files
+   of Non-GPL Code may instantiate templates or use macros or inline
+   functions from the Approved Interfaces without causing the resulting
+   work to be covered by the GNU General Public License.  Only Red Hat,
+   Inc. may make changes or additions to the list of Approved Interfaces.
+   Red Hat's grant of this exception is conditioned upon your not adding
+   any new exceptions.  If you wish to add a new Approved Interface or
+   exception, please contact Red Hat.  You must obey the GNU General Public
+   License in all respects for all of the Red Hat elfutils code and other
+   code used in conjunction with Red Hat elfutils except the Non-GPL Code
+   covered by this exception.  If you modify this file, you may extend this
+   exception to your version of the file, but you are not obligated to do
+   so.  If you do not wish to provide this exception without modification,
+   you must delete this exception statement from your version and license
+   this file solely under the GPL without exception.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifndef _ELFUTILS_VERSION_H
+#define _ELFUTILS_VERSION_H	1
+
+#define _ELFUTILS_VERSION	138
+
+#define _ELFUTILS_PREREQ(major, minor) \
+  (_ELFUTILS_VERSION >= ((major) * 1000 + (minor)))
+
+#endif	/* elfutils/version.h */
diff --git a/libdwfl/Android.mk b/libdwfl/Android.mk
index f742b5c..4fa544b 100755
--- a/libdwfl/Android.mk
+++ b/libdwfl/Android.mk
@@ -35,8 +35,10 @@
 	dwfl_error.c \
 	dwfl_module.c \
 	dwfl_module_addrdie.c \
+	dwfl_module_addrsym.c \
 	dwfl_module_build_id.c \
 	dwfl_module_getdwarf.c \
+	dwfl_module_getsym.c \
 	dwfl_report_elf.c \
 	find-debuginfo.c \
 	offline.c \