public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-10 18:29 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-10 18:29 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 3327 bytes --]

On Thu, 2014-04-10 at 18:38 +0200, Florian Weimer wrote:
> On 04/10/2014 06:10 PM, Mark Wielaard wrote:
> > Hi Florian,
> >
> > On Thu, 2014-04-10 at 13:19 +0200, Florian Weimer wrote:
> >> +2014-04-10  Florian Weimer  <fweimer@redhat.com>
> >> +
> >> +	* libdw.h (dwarf_debugaltlink): New function.
> >> +	* libdwP.h (IDX_debug_info): Add IDX_gnu_debugaltlink.
> >> +	(dwarf_debugaltlink): Internal declaration.
> >> +	* Makefile.am (libdw_a_SOURCES): Add dwarf_debugaltlink.c.
> >> +	* libdw.map (ELFUTILS_0.159): Export dwarf_debugaltlink.
> >> +	* dwarf_debugaltlink.c: New file.
> >> +	* dwarf_begin_elf.c (dwarf_scnnames): Add IDX_gnu_debugaltlink
> >> +	element.
> >> +	(check_section): Call open_debugaltlink.
> >
> > I like the helper function, but I think it is a little more low-level
> > than what we normally provide. We should at least (also) have a
> > dwarf_get_alt () that returns a Dwarf *.
> 
> This would just return the stored Dwarf *, and not attempt to open any 
> files?

Yes. dwarf_getalt () would just return the set Dwarf *alt (or NULL when
none was set).

> > If we provide this low-level function then it would be good to also
> > provide a similar one for .gnu_debuglink (which already exists privately
> > as find_debuglink in libdwfl) and for the build_id of an Elf file (which
> > also exist privately as __libdwfl_find_elf_build_id in libdwfl, but that
> > does a bit more by also determining the load address). If we provide
> > those helper functions because they might indeed be useful to people
> > wanting to write their own Elf/Dwarf file search functions, I am not
> > sure how to call them. I don't want people to confuse these lower-level
> > helper functions (which expose Elf file details) with the higher-level
> > libdw/Dwarf functionality.
> 
> We could add them at the ELF layer, but then we'd have to iterate over 
> all the ELF section headers in each of these functions.  The section 
> header array in libdw avoids this.  I'm also not sure where to put such 
> convenience functions.

Yeah, I might be designing things. You are right having it in libdw and
using the debug section array is the right thing to use. I am mostly
concerned about the naming because I think this functionality is at a
different level than the rest.

> libebl?  But I currently don't use that, and I 
> think some downstreams assign send-class status to it.

libebl is strictly for internal use, not for public functions.
The utility functions could just be part of libdw, just like the dwfl
functions are, just with a slightly different naming convention (let the
bike-shedding begin).

BTW. I don't know what assigning send-class status means.

> > I would make build_id_len the return value. Then you can return:
> > - 0 No debugaltlink found.
> > - > 0 Length of build_id, success.
> > - < 0 Error.
> 
> Hmm, I wonder if the interface is similar enough to read(2) so that the 
> tri-state return value isn't a problem.  Usually, it's problematic 
> because callers are tempted to treat the result as boolean, interpreting 
> -1 as success.

The tri-state return value pattern is used with more libdw functions, so
I don't think it will surprise our users. Especially not if we properly
document it :)

Cheers,

Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-11  9:36 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-11  9:36 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]

On Thu, 2014-04-10 at 20:41 +0200, Florian Weimer wrote:
> On 04/10/2014 08:29 PM, Mark Wielaard wrote:
> >> We could add them at the ELF layer, but then we'd have to iterate over
> >> all the ELF section headers in each of these functions.  The section
> >> header array in libdw avoids this.  I'm also not sure where to put such
> >> convenience functions.
> >
> > Yeah, I might be designing things. You are right having it in libdw and
                     ^ over-
> > using the debug section array is the right thing to use. I am mostly
> > concerned about the naming because I think this functionality is at a
> > different level than the rest.
> 
> So what about dwarf_elf_debugaltlink or even dwarf_elf_gnu_debugaltlink 
> as a name?  This shows the relationship to the underlying ELF data.

I like it. Maybe we could shorten it to dwelf_gnu_debugaltlink.

And then (if I am over-designing anyway) have a separate header file
libdwelf.h which is like libdwfl.h. But instead of having Dwarf Frontend
Library calls with dwfl_..., it would have Dwarf Elf Library Function
calls with dwelf_... Like the libdwfl.h functions they would be part of
libdw.so, but the user would know these are for different, low-level,
Elf-based Dwarf functionality. It would be good to have an explicit
place to put these low-level helper functions, it has come up before and
neither libelf nor libebl is really the right place for them. libdw
would be and with a separate header it would be clear the are
"different"/low-level.

I'll see if I can setup the build-infrastructure to add the new
libdwelf.h header, get it installed properly and make any functions
added part of libdw.so.

Cheers,

Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-10 18:41 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-10 18:41 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2264 bytes --]

On 04/10/2014 08:29 PM, Mark Wielaard wrote:

>>> I like the helper function, but I think it is a little more low-level
>>> than what we normally provide. We should at least (also) have a
>>> dwarf_get_alt () that returns a Dwarf *.
>>
>> This would just return the stored Dwarf *, and not attempt to open any
>> files?
>
> Yes. dwarf_getalt () would just return the set Dwarf *alt (or NULL when
> none was set).

Okay, I will include this in a revision of the patch.

>> We could add them at the ELF layer, but then we'd have to iterate over
>> all the ELF section headers in each of these functions.  The section
>> header array in libdw avoids this.  I'm also not sure where to put such
>> convenience functions.
>
> Yeah, I might be designing things. You are right having it in libdw and
> using the debug section array is the right thing to use. I am mostly
> concerned about the naming because I think this functionality is at a
> different level than the rest.

So what about dwarf_elf_debugaltlink or even dwarf_elf_gnu_debugaltlink 
as a name?  This shows the relationship to the underlying ELF data.

>> libebl?  But I currently don't use that, and I
>> think some downstreams assign send-class status to it.
>
> libebl is strictly for internal use, not for public functions.
> The utility functions could just be part of libdw, just like the dwfl
> functions are, just with a slightly different naming convention (let the
> bike-shedding begin).
>
> BTW. I don't know what assigning send-class status means.

Typo for "second-class". :)

>>> I would make build_id_len the return value. Then you can return:
>>> - 0 No debugaltlink found.
>>> - > 0 Length of build_id, success.
>>> - < 0 Error.
>>
>> Hmm, I wonder if the interface is similar enough to read(2) so that the
>> tri-state return value isn't a problem.  Usually, it's problematic
>> because callers are tempted to treat the result as boolean, interpreting
>> -1 as success.
>
> The tri-state return value pattern is used with more libdw functions, so
> I don't think it will surprise our users. Especially not if we properly
> document it :)

Okay, I will make this change as well.

-- 
Florian Weimer / Red Hat Product Security Team

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-10 16:38 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-10 16:38 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 3122 bytes --]

On 04/10/2014 06:10 PM, Mark Wielaard wrote:
> Hi Florian,
>
> On Thu, 2014-04-10 at 13:19 +0200, Florian Weimer wrote:
>> +2014-04-10  Florian Weimer  <fweimer@redhat.com>
>> +
>> +	* libdw.h (dwarf_debugaltlink): New function.
>> +	* libdwP.h (IDX_debug_info): Add IDX_gnu_debugaltlink.
>> +	(dwarf_debugaltlink): Internal declaration.
>> +	* Makefile.am (libdw_a_SOURCES): Add dwarf_debugaltlink.c.
>> +	* libdw.map (ELFUTILS_0.159): Export dwarf_debugaltlink.
>> +	* dwarf_debugaltlink.c: New file.
>> +	* dwarf_begin_elf.c (dwarf_scnnames): Add IDX_gnu_debugaltlink
>> +	element.
>> +	(check_section): Call open_debugaltlink.
>
> I like the helper function, but I think it is a little more low-level
> than what we normally provide. We should at least (also) have a
> dwarf_get_alt () that returns a Dwarf *.

This would just return the stored Dwarf *, and not attempt to open any 
files?

> If we provide this low-level function then it would be good to also
> provide a similar one for .gnu_debuglink (which already exists privately
> as find_debuglink in libdwfl) and for the build_id of an Elf file (which
> also exist privately as __libdwfl_find_elf_build_id in libdwfl, but that
> does a bit more by also determining the load address). If we provide
> those helper functions because they might indeed be useful to people
> wanting to write their own Elf/Dwarf file search functions, I am not
> sure how to call them. I don't want people to confuse these lower-level
> helper functions (which expose Elf file details) with the higher-level
> libdw/Dwarf functionality.

We could add them at the ELF layer, but then we'd have to iterate over 
all the ELF section headers in each of these functions.  The section 
header array in libdw avoids this.  I'm also not sure where to put such 
convenience functions.  libebl?  But I currently don't use that, and I 
think some downstreams assign send-class status to it.

>> +int dwarf_debugaltlink (Dwarf *dwarf,
>> +			const char **alt_name,
>> +			const void **build_id,
>> +			size_t *build_id_len)
>> +{
>> +  Elf_Data *data = dwarf->sectiondata[IDX_gnu_debugaltlink];
>> +  if (data == NULL)
>> +    {
>> +      __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
>> +      return -1;
>> +    }
>> +
>> +  const void *ptr = memchr (data->d_buf, '\0', data->d_size);
>> +  if (ptr == NULL)
>> +    {
>> +      __libdw_seterrno (DWARF_E_INVALID_ELF);
>> +      return -1;
>> +    }
>> +  *alt_name = data->d_buf;
>> +  *build_id = ptr + 1;
>> +  *build_id_len = data->d_size - (ptr - data->d_buf + 1);
>> +  return 0;
>> +}
>
> I would make build_id_len the return value. Then you can return:
> - 0 No debugaltlink found.
> - > 0 Length of build_id, success.
> - < 0 Error.

Hmm, I wonder if the interface is similar enough to read(2) so that the 
tri-state return value isn't a problem.  Usually, it's problematic 
because callers are tempted to treat the result as boolean, interpreting 
-1 as success.

I've picked up the other suggestions.

-- 
Florian Weimer / Red Hat Product Security Team

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-10 16:10 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-10 16:10 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 3144 bytes --]

Hi Florian,

On Thu, 2014-04-10 at 13:19 +0200, Florian Weimer wrote:
> +2014-04-10  Florian Weimer  <fweimer@redhat.com>
> +
> +	* libdw.h (dwarf_debugaltlink): New function.
> +	* libdwP.h (IDX_debug_info): Add IDX_gnu_debugaltlink.
> +	(dwarf_debugaltlink): Internal declaration.
> +	* Makefile.am (libdw_a_SOURCES): Add dwarf_debugaltlink.c.
> +	* libdw.map (ELFUTILS_0.159): Export dwarf_debugaltlink.
> +	* dwarf_debugaltlink.c: New file.
> +	* dwarf_begin_elf.c (dwarf_scnnames): Add IDX_gnu_debugaltlink
> +	element.
> +	(check_section): Call open_debugaltlink.

I like the helper function, but I think it is a little more low-level
than what we normally provide. We should at least (also) have a
dwarf_get_alt () that returns a Dwarf *.

If we provide this low-level function then it would be good to also
provide a similar one for .gnu_debuglink (which already exists privately
as find_debuglink in libdwfl) and for the build_id of an Elf file (which
also exist privately as __libdwfl_find_elf_build_id in libdwfl, but that
does a bit more by also determining the load address). If we provide
those helper functions because they might indeed be useful to people
wanting to write their own Elf/Dwarf file search functions, I am not
sure how to call them. I don't want people to confuse these lower-level
helper functions (which expose Elf file details) with the higher-level
libdw/Dwarf functionality.

> +#ifdef ENABLE_DWZ
> +  /* For dwz multifile support, ignore if it looks wrong.  */
> +  if (result->sectiondata[IDX_gnu_debugaltlink] != NULL)
> +    {
> +      const char *alt_name;
> +      const void *build_id;
> +      size_t id_len;
> +      if (INTUSE (dwarf_debugaltlink) (result, &alt_name, &build_id, &id_len)
> +	  == 0)
> +	return open_debugaltlink (result, alt_name, build_id, id_len);
> +    }
> +#endif /* ENABLE_DWZ */

Since open_debugaltlink already does the != NULL check you don't need to
repeat it here.

> +int dwarf_debugaltlink (Dwarf *dwarf,
> +			const char **alt_name,
> +			const void **build_id,
> +			size_t *build_id_len)
> +{
> +  Elf_Data *data = dwarf->sectiondata[IDX_gnu_debugaltlink];
> +  if (data == NULL)
> +    {
> +      __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
> +      return -1;
> +    }
> +
> +  const void *ptr = memchr (data->d_buf, '\0', data->d_size);
> +  if (ptr == NULL)
> +    {
> +      __libdw_seterrno (DWARF_E_INVALID_ELF);
> +      return -1;
> +    }
> +  *alt_name = data->d_buf;
> +  *build_id = ptr + 1;
> +  *build_id_len = data->d_size - (ptr - data->d_buf + 1);
> +  return 0;
> +}

I would make build_id_len the return value. Then you can return:
- 0 No debugaltlink found.
- > 0 Length of build_id, success.
- < 0 Error.

> +/* Get the data from the .gnu_debugaltlink section.  */
> +extern int dwarf_debugaltlink (Dwarf *dwarf,
> +			       const char **alt_name,
> +			       const void **build_id,
> +			       size_t *build_id_len);

Make sure to document lifetime/ownership. Pointers valid as long as
Dwarf is. Might be obvious, but better be sure.

Thanks,

Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function
@ 2014-04-10 11:19 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-10 11:19 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 8411 bytes --]

Signed-off-by: Florian Weimer <fweimer@redhat.com>
---
 libdw/ChangeLog            | 12 +++++++++
 libdw/Makefile.am          |  3 ++-
 libdw/dwarf_begin_elf.c    | 36 +++++++++++++--------------
 libdw/dwarf_debugaltlink.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 libdw/libdw.h              |  8 +++++-
 libdw/libdw.map            |  5 ++++
 libdw/libdwP.h             |  4 ++-
 7 files changed, 107 insertions(+), 22 deletions(-)
 create mode 100644 libdw/dwarf_debugaltlink.c

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 1d9b9a3..581fc52 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,15 @@
+2014-04-10  Florian Weimer  <fweimer@redhat.com>
+
+	* libdw.h (dwarf_debugaltlink): New function.
+	* libdwP.h (IDX_debug_info): Add IDX_gnu_debugaltlink.
+	(dwarf_debugaltlink): Internal declaration.
+	* Makefile.am (libdw_a_SOURCES): Add dwarf_debugaltlink.c.
+	* libdw.map (ELFUTILS_0.159): Export dwarf_debugaltlink.
+	* dwarf_debugaltlink.c: New file.
+	* dwarf_begin_elf.c (dwarf_scnnames): Add IDX_gnu_debugaltlink
+	element.
+	(check_section): Call open_debugaltlink.
+
 2014-03-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Fix abort() on missing section headers.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index cd9e314..c40410d 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -87,7 +87,8 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
 		  dwarf_cfi_addrframe.c \
 		  dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
 		  dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
-		  dwarf_getlocation_die.c dwarf_getlocation_attr.c
+		  dwarf_getlocation_die.c dwarf_getlocation_attr.c \
+		  dwarf_debugaltlink.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 79daeac..a2bf245 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -1,5 +1,5 @@
 /* Create descriptor from ELF descriptor for processing file.
-   Copyright (C) 2002-2011 Red Hat, Inc.
+   Copyright (C) 2002-2011, 2014 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -54,7 +54,7 @@
 
 
 /* Section names.  */
-static const char dwarf_scnnames[IDX_last][17] =
+static const char dwarf_scnnames[IDX_last][18] =
 {
   [IDX_debug_info] = ".debug_info",
   [IDX_debug_types] = ".debug_types",
@@ -67,7 +67,8 @@ static const char dwarf_scnnames[IDX_last][17] =
   [IDX_debug_str] = ".debug_str",
   [IDX_debug_macinfo] = ".debug_macinfo",
   [IDX_debug_macro] = ".debug_macro",
-  [IDX_debug_ranges] = ".debug_ranges"
+  [IDX_debug_ranges] = ".debug_ranges",
+  [IDX_gnu_debugaltlink] = ".gnu_debugaltlink"
 };
 #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
 
@@ -223,22 +224,6 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
       return NULL;
     }
 
-#ifdef ENABLE_DWZ
-  /* For dwz multifile support, ignore if it looks wrong.  */
-  if (strcmp (scnname, ".gnu_debugaltlink") == 0)
-    {
-      Elf_Data *data = elf_getdata (scn, NULL);
-      if (data != NULL && data->d_size != 0)
-	{
-	  const char *alt_name = data->d_buf;
-	  const void *build_id = memchr (data->d_buf, '\0', data->d_size);
-	  const int id_len = data->d_size - (build_id - data->d_buf + 1);
-	  if (alt_name && build_id && id_len > 0)
-	    return open_debugaltlink (result, alt_name, build_id + 1, id_len);
-	}
-    }
-#endif /* ENABLE_DWZ */
-
   /* Recognize the various sections.  Most names start with .debug_.  */
   size_t cnt;
   for (cnt = 0; cnt < ndwarf_scnnames; ++cnt)
@@ -328,6 +313,19 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
       }
 #endif
 
+#ifdef ENABLE_DWZ
+  /* For dwz multifile support, ignore if it looks wrong.  */
+  if (result->sectiondata[IDX_gnu_debugaltlink] != NULL)
+    {
+      const char *alt_name;
+      const void *build_id;
+      size_t id_len;
+      if (INTUSE (dwarf_debugaltlink) (result, &alt_name, &build_id, &id_len)
+	  == 0)
+	return open_debugaltlink (result, alt_name, build_id, id_len);
+    }
+#endif /* ENABLE_DWZ */
+
   return result;
 }
 
diff --git a/libdw/dwarf_debugaltlink.c b/libdw/dwarf_debugaltlink.c
new file mode 100644
index 0000000..2d0b68c
--- /dev/null
+++ b/libdw/dwarf_debugaltlink.c
@@ -0,0 +1,61 @@
+/* Create descriptor from ELF descriptor for processing file.
+   Copyright (C) 2012, 2014 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   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 copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#include "libdwP.h"
+
+int dwarf_debugaltlink (Dwarf *dwarf,
+			const char **alt_name,
+			const void **build_id,
+			size_t *build_id_len)
+{
+  Elf_Data *data = dwarf->sectiondata[IDX_gnu_debugaltlink];
+  if (data == NULL)
+    {
+      __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
+      return -1;
+    }
+
+  const void *ptr = memchr (data->d_buf, '\0', data->d_size);
+  if (ptr == NULL)
+    {
+      __libdw_seterrno (DWARF_E_INVALID_ELF);
+      return -1;
+    }
+  *alt_name = data->d_buf;
+  *build_id = ptr + 1;
+  *build_id_len = data->d_size - (ptr - data->d_buf + 1);
+  return 0;
+}
+
+INTDEF (dwarf_debugaltlink)
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 0d94c52..2682989 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -1,5 +1,5 @@
 /* Interfaces for libdw.
-   Copyright (C) 2002-2010, 2013 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2013, 2014 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -267,6 +267,12 @@ extern int dwarf_end (Dwarf *dwarf);
 /* Get the data block for the .debug_info section.  */
 extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf);
 
+/* Get the data from the .gnu_debugaltlink section.  */
+extern int dwarf_debugaltlink (Dwarf *dwarf,
+			       const char **alt_name,
+			       const void **build_id,
+			       size_t *build_id_len);
+
 /* Read the header for the DWARF CU.  */
 extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
 			 size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
diff --git a/libdw/libdw.map b/libdw/libdw.map
index d0e4731..92605d0 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -292,3 +292,8 @@ ELFUTILS_0.158 {
     dwfl_core_file_attach;
     dwfl_linux_proc_attach;
 } ELFUTILS_0.157;
+
+ELFUTILS_0.159 {
+  global:
+    dwarf_debugaltlink;
+} ELFUTILS_0.158;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 4939200..28d6260 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -1,5 +1,5 @@
 /* Internal definitions for libdwarf.
-   Copyright (C) 2002-2011, 2013 Red Hat, Inc.
+   Copyright (C) 2002-2011, 2013, 2014 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -74,6 +74,7 @@ enum
     IDX_debug_macinfo,
     IDX_debug_macro,
     IDX_debug_ranges,
+    IDX_gnu_debugaltlink,
     IDX_last
   };
 
@@ -676,6 +677,7 @@ INTDECL (dwarf_begin_elf)
 INTDECL (dwarf_child)
 INTDECL (dwarf_dieoffset)
 INTDECL (dwarf_diename)
+INTDECL (dwarf_debugaltlink)
 INTDECL (dwarf_end)
 INTDECL (dwarf_entrypc)
 INTDECL (dwarf_errmsg)
-- 
1.9.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-11  9:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 18:29 [PATCH v2 1/3] libdw: Add dwarf_debugaltlink function Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-04-11  9:36 Mark Wielaard
2014-04-10 18:41 Florian Weimer
2014-04-10 16:38 Florian Weimer
2014-04-10 16:10 Mark Wielaard
2014-04-10 11:19 Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).