public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-17 15:17 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-17 15:17 UTC (permalink / raw)
  To: elfutils-devel

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

Hi Florian,

Looks good, just some nitpicks.

On Tue, 2014-04-15 at 14:31 +0200, Florian Weimer wrote:
> +++ b/libdw/dwarf_getalt.c
> @@ -0,0 +1,42 @@
> +/* Create descriptor from ELF descriptor for processing file.

This isn't a great description.

> diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
> +/* Create descriptor from ELF descriptor for processing file.

Same here.

> +void
> +dwarf_setalt (Dwarf *main, Dwarf *alt)
> +{
> +  if (main->free_alt)
> +    INTUSE (dwarf_end) (main->alt_dwarf);
> +  main->free_alt = false;
> +  main->alt_dwarf = alt;
> +}
> +INTDEF (dwarf_setalt)

Two questions. I think either answer is fine, but it should be
explicitly said/documented.
1) Should we verify the underlying ELF files to see whether there is
a .gnu_debugaltlink with matching build_id in the alt file? If not then
we should document that the user is responsible for the sanity checking.
2) Should we allow resetting the alt file once set? If we do, like here,
we should add a warning to dwarf_getalt that dwarf_setalt might
reset/end the underlying Dwarf.
 
> +/* Retrieve DWARF descriptor for debugaltlink data.  Returns NULL if
> +   no alternate debug data has been supplied.  */
> +extern Dwarf *dwarf_getalt (Dwarf *main);
> +
> +/* Provides the data referenced by the .gnu_debugaltlink section.  It
> +   is the responsibility of the caller to ensure that the data
> +   referenced by ALT stays valid until dwarf_end (MAIN) is called.  */
> +extern void dwarf_setalt (Dwarf *main, Dwarf *alt);

So whatever is decided should be documented here.

Cheers,

Mark



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

* Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-23 12:28 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-23 12:28 UTC (permalink / raw)
  To: elfutils-devel

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

On Tue, 2014-04-22 at 09:26 +0200, Florian Weimer wrote:
> > Could you post an updated patch with that documentation change. The code
> > is fine, so I want to add it to my branch now.
> 
> Here's the patch.  Thanks.

Rebased mjw/dwelf to master and added this patch.

Thanks,

Mark


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

* Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-22  7:26 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-22  7:26 UTC (permalink / raw)
  To: elfutils-devel

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

On 04/18/2014 12:35 PM, Mark Wielaard wrote:

> So I think the documentation for dwarf_setalt is fine now. But for
> dwarf_getalt I made you add a confusing sentence "Unless..." lets just
> remove that.
>
> Could you post an updated patch with that documentation change. The code
> is fine, so I want to add it to my branch now.

Here's the patch.  Thanks.

-- 
Florian Weimer / Red Hat Product Security Team

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-libdw-Add-dwarf_getalt-dwarf_setalt.patch --]
[-- Type: text/x-patch, Size: 6715 bytes --]

>From c557ee04554c1f16260106c5a3d991700cc2da7f Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 15 Apr 2014 14:31:55 +0200
Subject: [PATCH] libdw: Add dwarf_getalt, dwarf_setalt

Signed-off-by: Florian Weimer <fweimer@redhat.com>
---
 libdw/ChangeLog      |  9 +++++++++
 libdw/Makefile.am    |  3 ++-
 libdw/dwarf_getalt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 libdw/dwarf_setalt.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 libdw/libdw.h        | 12 ++++++++++++
 libdw/libdw.map      |  2 ++
 libdw/libdwP.h       |  2 ++
 7 files changed, 112 insertions(+), 1 deletion(-)
 create mode 100644 libdw/dwarf_getalt.c
 create mode 100644 libdw/dwarf_setalt.c

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 5c35ec2..698e346 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,12 @@
+2014-04-22  Florian Weimer  <fweimer@redhat.com>
+
+	* dwarf_getalt.c, dwarf_setalt.c: New files.
+	* Makefile.am (libdw_a_SOURCES): Add them.
+	* libdw.h (dwarf_getalt, dwarf_setalt): Add function declarations.
+	* libdwP.h (dwarf_getalt, dwarf_setalt): Add internal function
+	declarations.
+	* libdw.map (ELFUTILS_0.159): Export the two new functions.
+
 2014-04-15  Florian Weimer  <fweimer@redhat.com>
 
 	* libdwP.h (enum IDX_gnu_debugaltlink): New.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index ca67f2c..8538d36 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -85,7 +85,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_getalt.c dwarf_setalt.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
diff --git a/libdw/dwarf_getalt.c b/libdw/dwarf_getalt.c
new file mode 100644
index 0000000..cc434f0
--- /dev/null
+++ b/libdw/dwarf_getalt.c
@@ -0,0 +1,42 @@
+/* Retrieves the DWARF descriptor for debugaltlink data.
+   Copyright (C) 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 "libdwP.h"
+
+Dwarf *
+dwarf_getalt (Dwarf *main)
+{
+  if (main == NULL)
+    return NULL;
+  return main->alt_dwarf;
+}
+INTDEF (dwarf_getalt)
diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
new file mode 100644
index 0000000..3b5b935
--- /dev/null
+++ b/libdw/dwarf_setalt.c
@@ -0,0 +1,43 @@
+/* Provides the data referenced by the .gnu_debugaltlink section.
+   Copyright (C) 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 "libdwP.h"
+
+void
+dwarf_setalt (Dwarf *main, Dwarf *alt)
+{
+  if (main->free_alt)
+    INTUSE (dwarf_end) (main->alt_dwarf);
+  main->free_alt = false;
+  main->alt_dwarf = alt;
+}
+INTDEF (dwarf_setalt)
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 0d94c52..a4654c4 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -260,6 +260,18 @@ 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);
 
+/* Retrieves the DWARF descriptor for debugaltlink data.  Returns NULL
+   if no alternate debug data has been supplied.  */
+extern Dwarf *dwarf_getalt (Dwarf *main);
+
+/* Provides the data referenced by the .gnu_debugaltlink section.  The
+   caller should check that MAIN and ALT match (i.e., they have the
+   same build ID).  It is the responsibility of the caller to ensure
+   that the data referenced by ALT stays valid while it is used by
+   MAIN, until dwarf_setalt is called on MAIN with a different
+   descriptor, or dwarf_end.  */
+extern void dwarf_setalt (Dwarf *main, Dwarf *alt);
+
 /* Release debugging handling context.  */
 extern int dwarf_end (Dwarf *dwarf);
 
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 0e75fcb..71247e3 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -295,5 +295,7 @@ ELFUTILS_0.158 {
 
 ELFUTILS_0.159 {
   global:
+    dwarf_getalt;
+    dwarf_setalt;
     dwelf_elf_gnu_debuglink;
 } ELFUTILS_0.158;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index a688456..1c94767 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -686,6 +686,7 @@ INTDECL (dwarf_formref_die)
 INTDECL (dwarf_formsdata)
 INTDECL (dwarf_formstring)
 INTDECL (dwarf_formudata)
+INTDECL (dwarf_getalt)
 INTDECL (dwarf_getarange_addr)
 INTDECL (dwarf_getarangeinfo)
 INTDECL (dwarf_getaranges)
@@ -701,6 +702,7 @@ INTDECL (dwarf_nextcu)
 INTDECL (dwarf_next_unit)
 INTDECL (dwarf_offdie)
 INTDECL (dwarf_ranges)
+INTDECL (dwarf_setalt)
 INTDECL (dwarf_siblingof)
 INTDECL (dwarf_srclang)
 INTDECL (dwarf_tag)
-- 
1.9.0


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

* Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-18 10:35 Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2014-04-18 10:35 UTC (permalink / raw)
  To: elfutils-devel

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

On Thu, 2014-04-17 at 17:33 +0200, Florian Weimer wrote:
> > Two questions. I think either answer is fine, but it should be
> > explicitly said/documented.
> > 1) Should we verify the underlying ELF files to see whether there is
> > a .gnu_debugaltlink with matching build_id in the alt file? If not then
> > we should document that the user is responsible for the sanity checking.
> 
> I don't think we should.  I think build IDs are optional, and we do not 
> have sufficient information about the file paths to check that they match.

OK agreed. Documentation looks good.

> > 2) Should we allow resetting the alt file once set? If we do, like here,
> > we should add a warning to dwarf_getalt that dwarf_setalt might
> > reset/end the underlying Dwarf.
> 
> But it doesn't—dwarf_setalt does not take ownership.  I tried to make 
> this more clear:
> 
> /* Retrieves the DWARF descriptor for debugaltlink data.  Returns NULL
>     if no alternate debug data has been supplied.  Unless the
>     debugaltlink data was provided by calling dwarf_setalt, a call to
>     dwarf_end (MAIN) will deallocate it, invalidating the returned
>     pointer.  */
> extern Dwarf *dwarf_getalt (Dwarf *main);
> 
> /* Provides the data referenced by the .gnu_debugaltlink section.  The
>     caller should check that MAIN and ALT match (i.e., they have the
>     same build ID).  It is the responsibility of the caller to ensure
>     that the data referenced by ALT stays valid while it is used by
>     MAIN, until dwarf_setalt is called on MAIN with a different
>     descriptor, or dwarf_end.  */
> extern void dwarf_setalt (Dwarf *main, Dwarf *alt);

Aha, I see why I was confused. Sorry. The "problem" isn't here. It is in
patch 5 "Move .gnu_debugaltlink handling from libdw to libdwfl" (I'll
comment in a minute on that one). When the handling is moved the whole
free_alt flag should be removed from the struct Dwarf and put in the
struct Dwfl_Module IMHO. Then it is also clear in the code that libdw
itself never takes ownership itself.

So I think the documentation for dwarf_setalt is fine now. But for
dwarf_getalt I made you add a confusing sentence "Unless..." lets just
remove that.

Could you post an updated patch with that documentation change. The code
is fine, so I want to add it to my branch now.

Thanks,

Mark


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

* Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-17 15:33 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-17 15:33 UTC (permalink / raw)
  To: elfutils-devel

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

On 04/17/2014 05:17 PM, Mark Wielaard wrote:
> Hi Florian,
>
> Looks good, just some nitpicks.
>
> On Tue, 2014-04-15 at 14:31 +0200, Florian Weimer wrote:
>> +++ b/libdw/dwarf_getalt.c
>> @@ -0,0 +1,42 @@
>> +/* Create descriptor from ELF descriptor for processing file.
>
> This isn't a great description.
>
>> diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
>> +/* Create descriptor from ELF descriptor for processing file.
>
> Same here.

I'm now using the first sentence from the comments in the header file:

/* Retrieves the DWARF descriptor for debugaltlink data.

/* Provides the data referenced by the .gnu_debugaltlink section.

>> +void
>> +dwarf_setalt (Dwarf *main, Dwarf *alt)
>> +{
>> +  if (main->free_alt)
>> +    INTUSE (dwarf_end) (main->alt_dwarf);
>> +  main->free_alt = false;
>> +  main->alt_dwarf = alt;
>> +}
>> +INTDEF (dwarf_setalt)
>
> Two questions. I think either answer is fine, but it should be
> explicitly said/documented.
> 1) Should we verify the underlying ELF files to see whether there is
> a .gnu_debugaltlink with matching build_id in the alt file? If not then
> we should document that the user is responsible for the sanity checking.

I don't think we should.  I think build IDs are optional, and we do not 
have sufficient information about the file paths to check that they match.

> 2) Should we allow resetting the alt file once set? If we do, like here,
> we should add a warning to dwarf_getalt that dwarf_setalt might
> reset/end the underlying Dwarf.

But it doesn't—dwarf_setalt does not take ownership.  I tried to make 
this more clear:

/* Retrieves the DWARF descriptor for debugaltlink data.  Returns NULL
    if no alternate debug data has been supplied.  Unless the
    debugaltlink data was provided by calling dwarf_setalt, a call to
    dwarf_end (MAIN) will deallocate it, invalidating the returned
    pointer.  */
extern Dwarf *dwarf_getalt (Dwarf *main);

/* Provides the data referenced by the .gnu_debugaltlink section.  The
    caller should check that MAIN and ALT match (i.e., they have the
    same build ID).  It is the responsibility of the caller to ensure
    that the data referenced by ALT stays valid while it is used by
    MAIN, until dwarf_setalt is called on MAIN with a different
    descriptor, or dwarf_end.  */
extern void dwarf_setalt (Dwarf *main, Dwarf *alt);


-- 
Florian Weimer / Red Hat Product Security Team

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

* [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
@ 2014-04-15 12:31 Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2014-04-15 12:31 UTC (permalink / raw)
  To: elfutils-devel

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

Signed-off-by: Florian Weimer <fweimer@redhat.com>
---
 libdw/ChangeLog      |  7 +++++++
 libdw/Makefile.am    |  3 ++-
 libdw/dwarf_getalt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 libdw/dwarf_setalt.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 libdw/libdw.h        |  9 +++++++++
 libdw/libdw.map      |  2 ++
 libdw/libdwP.h       |  2 ++
 7 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 libdw/dwarf_getalt.c
 create mode 100644 libdw/dwarf_setalt.c

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index d740b2b..1ecdb02 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -6,6 +6,13 @@
 	(check_section): Obtain .gnu_debugaltlink section from the
 	setiondata array.
 
+	* dwarf_getalt.c, dwarf_setalt.c: New files.
+	* Makefile.am (libdw_a_SOURCES): Add them.
+	* libdw.h (dwarf_getalt, dwarf_setalt): Add function declarations.
+	* libdwP.h (dwarf_getalt, dwarf_setalt): Add internal function
+	declarations.
+	* libdw.map (ELFUTILS_0.159): Export the two new functions.
+
 2014-04-11  Mark Wielaard  <mjw@redhat.com>
 
 	* libdw.map (ELFUTILS_0.159): New. Add dwelf_elf_gnu_debuglink.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index f8d8e0d..4fcd300 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_getalt.c dwarf_setalt.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
diff --git a/libdw/dwarf_getalt.c b/libdw/dwarf_getalt.c
new file mode 100644
index 0000000..4351d94
--- /dev/null
+++ b/libdw/dwarf_getalt.c
@@ -0,0 +1,42 @@
+/* Create descriptor from ELF descriptor for processing file.
+   Copyright (C) 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 "libdwP.h"
+
+Dwarf *
+dwarf_getalt (Dwarf *main)
+{
+  if (main == NULL)
+    return NULL;
+  return main->alt_dwarf;
+}
+INTDEF (dwarf_getalt)
diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
new file mode 100644
index 0000000..6767d11
--- /dev/null
+++ b/libdw/dwarf_setalt.c
@@ -0,0 +1,43 @@
+/* Create descriptor from ELF descriptor for processing file.
+   Copyright (C) 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 "libdwP.h"
+
+void
+dwarf_setalt (Dwarf *main, Dwarf *alt)
+{
+  if (main->free_alt)
+    INTUSE (dwarf_end) (main->alt_dwarf);
+  main->free_alt = false;
+  main->alt_dwarf = alt;
+}
+INTDEF (dwarf_setalt)
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 0d94c52..8e31ad6 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -260,6 +260,15 @@ 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);
 
+/* Retrieve DWARF descriptor for debugaltlink data.  Returns NULL if
+   no alternate debug data has been supplied.  */
+extern Dwarf *dwarf_getalt (Dwarf *main);
+
+/* Provides the data referenced by the .gnu_debugaltlink section.  It
+   is the responsibility of the caller to ensure that the data
+   referenced by ALT stays valid until dwarf_end (MAIN) is called.  */
+extern void dwarf_setalt (Dwarf *main, Dwarf *alt);
+
 /* Release debugging handling context.  */
 extern int dwarf_end (Dwarf *dwarf);
 
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 0e75fcb..71247e3 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -295,5 +295,7 @@ ELFUTILS_0.158 {
 
 ELFUTILS_0.159 {
   global:
+    dwarf_getalt;
+    dwarf_setalt;
     dwelf_elf_gnu_debuglink;
 } ELFUTILS_0.158;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index a688456..1c94767 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -686,6 +686,7 @@ INTDECL (dwarf_formref_die)
 INTDECL (dwarf_formsdata)
 INTDECL (dwarf_formstring)
 INTDECL (dwarf_formudata)
+INTDECL (dwarf_getalt)
 INTDECL (dwarf_getarange_addr)
 INTDECL (dwarf_getarangeinfo)
 INTDECL (dwarf_getaranges)
@@ -701,6 +702,7 @@ INTDECL (dwarf_nextcu)
 INTDECL (dwarf_next_unit)
 INTDECL (dwarf_offdie)
 INTDECL (dwarf_ranges)
+INTDECL (dwarf_setalt)
 INTDECL (dwarf_siblingof)
 INTDECL (dwarf_srclang)
 INTDECL (dwarf_tag)
-- 
1.9.0


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

end of thread, other threads:[~2014-04-23 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 15:17 [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-04-23 12:28 Mark Wielaard
2014-04-22  7:26 Florian Weimer
2014-04-18 10:35 Mark Wielaard
2014-04-17 15:33 Florian Weimer
2014-04-15 12:31 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).