]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Cosmetic changes
authorPetr Machata <pmachata@redhat.com>
Wed, 6 May 2009 13:04:16 +0000 (15:04 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 6 May 2009 13:04:16 +0000 (15:04 +0200)
libdw/Makefile.am
libdw/dwarf_ranges.c
libdw/libdwP.h
libdw/libdw_readhooks.c [deleted file]

index 3ccd41e3630e0f9904a8adb60a61f71188f154d1..e624ac10856f66b2dcbf987c3f9317eb1ec07af6 100644 (file)
@@ -83,7 +83,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
                  dwarf_func_inline.c dwarf_getsrc_file.c \
                  libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
                  libdw_visit_scopes.c \
-                 dwarf_entry_breakpoints.c libdw_readhooks.c
+                 dwarf_entry_breakpoints.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
index 68301295685fb0448069f3ee3911531617256a90..2da713f26b0ce73fc4a86f8006c1f4a338ab46a9 100644 (file)
@@ -70,10 +70,8 @@ __libdw_read_begin_end_pair_inc (Dwarf *dbg, int sec_index,
     = width == 8 ? (Elf64_Addr) -1 : (Elf64_Addr) (Elf32_Addr) -1;
   Dwarf_Addr begin, end;
 
-  bool begin_relocated
-    = !READ_AND_RELOCATE (__libdw_relocate_address, begin);
-  bool end_relocated
-    = !READ_AND_RELOCATE (__libdw_relocate_address, end);
+  bool begin_relocated = READ_AND_RELOCATE (__libdw_relocate_address, begin);
+  bool end_relocated = READ_AND_RELOCATE (__libdw_relocate_address, end);
 
   /* Unrelocated escape for begin means base address selection.  */
   if (begin == escape && !begin_relocated)
index 9d1bc93f86687621d4a01e973167591bc41a830f..5fe3f1959920de94ea4dbdb6a12346fe3a8f78ad 100644 (file)
@@ -422,14 +422,38 @@ extern int __dwarf_errno_internal (void);
 
 /* Reader hooks.  */
 
+/* Relocation hooks return -1 on error (in that case the error code
+   must already have been set), 0 if there is no relocation and 1 if a
+   relocation was present.*/
+
+static inline int
+__libdw_relocate_address (Dwarf *dbg __attribute__ ((unused)),
+                         int sec_index __attribute__ ((unused)),
+                         void *addr __attribute__ ((unused)),
+                         int width __attribute__ ((unused)),
+                         Dwarf_Addr *val __attribute__ ((unused)))
+{
+  return 0;
+}
+
+static inline int
+__libdw_relocate_offset (Dwarf *dbg __attribute__ ((unused)),
+                        int sec_index __attribute__ ((unused)),
+                        void *addr __attribute__ ((unused)),
+                        int width __attribute__ ((unused)),
+                        Dwarf_Off *val __attribute__ ((unused)))
+{
+  return 0;
+}
+
 static inline bool
 __libdw_in_section (Dwarf *dbg, int sec_index,
                    unsigned char *addr, int width)
 {
   Elf_Data *data = dbg->sectiondata[sec_index];
 
-  if ((void *)addr < data->d_buf
-      || (void *)addr + width > data->d_buf + data->d_size)
+  if ((void *) addr < data->d_buf
+      || (void *) addr + width > data->d_buf + data->d_size)
     {
       __libdw_seterrno (DWARF_E_INVALID_OFFSET);
       return false;
@@ -446,25 +470,11 @@ __libdw_offset_in_section (Dwarf *dbg, int sec_index,
   return __libdw_in_section (dbg, sec_index, data->d_buf + offset, width);
 }
 
-/* Relocation hooks return -1 on error, 0 if there is no relocation
-   and 1 if a relocation was present.*/
-int __libdw_relocate_address (Dwarf *dbg,
-                             int sec_index, uintptr_t addr,
-                             int width, Dwarf_Addr *val)
-  internal_function;
-
-int __libdw_relocate_offset (Dwarf *dbg,
-                            int sec_index, uintptr_t addr,
-                            int width, Dwarf_Off *val)
-  internal_function;
-
 #define READ_AND_RELOCATE(RELOC_HOOK, VAL)                             \
   ({                                                                   \
     if (!__libdw_in_section (dbg, sec_index, *addr, width))            \
       return -1;                                                       \
                                                                        \
-    uintptr_t addr0 = (uintptr_t) *addr;                               \
-                                                                       \
     if (width == 4)                                                    \
       VAL = read_4ubyte_unaligned_inc (dbg, *addr);                    \
     else                                                               \
@@ -473,10 +483,10 @@ int __libdw_relocate_offset (Dwarf *dbg,
        VAL = read_8ubyte_unaligned_inc (dbg, *addr);                   \
       }                                                                        \
                                                                        \
-    int status = RELOC_HOOK (dbg, sec_index, addr0, width, &VAL);      \
-    if (status == -1)                                                  \
+    int status = RELOC_HOOK (dbg, sec_index, *addr, width, &VAL);      \
+    if (status < 0)                                                    \
       return status;                                                   \
-    status;                                                            \
+    status > 0;                                                                \
    })
 
 static inline int
@@ -506,20 +516,19 @@ __libdw_read_offset_inc (Dwarf *dbg,
 }
 
 /* Read up begin/end pair and increment read pointer.
-    - If it's normal range record, set up `*beginp' and `*endp' and return 0.
-    - If it's base address selection record, set up `*basep' and return 1.
+    - If it's normal range record, set up *BEGINP and *ENDP and return 0.
+    - If it's base address selection record, set up *BASEP and return 1.
     - If it's end of rangelist, don't set anything and return 2
     - If an error occurs, don't set anything and return <0.  */
-int
-__libdw_read_begin_end_pair_inc (Dwarf *dbg, int sec_index,
-                                unsigned char **addr, int width,
-                                Dwarf_Addr *beginp, Dwarf_Addr *endp,
-                                Dwarf_Addr *basep)
+int __libdw_read_begin_end_pair_inc (Dwarf *dbg, int sec_index,
+                                    unsigned char **addr, int width,
+                                    Dwarf_Addr *beginp, Dwarf_Addr *endp,
+                                    Dwarf_Addr *basep)
   internal_function;
 
-unsigned char *
-__libdw_formptr (Dwarf_Attribute *attr, int sec_index,
-                int err_nodata, unsigned char **endpp, Dwarf_Off *offsetp)
+unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
+                                int err_nodata, unsigned char **endpp,
+                                Dwarf_Off *offsetp)
   internal_function;
 
 static inline int
diff --git a/libdw/libdw_readhooks.c b/libdw/libdw_readhooks.c
deleted file mode 100644 (file)
index 404f12a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Definition of reader hooks.
-   Copyright (C) 2009 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>.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "libdwP.h"
-
-internal_function int
-__libdw_relocate_address (Dwarf *dbg __attribute__ ((unused)),
-                         int sec_index __attribute__ ((unused)),
-                         uintptr_t addr __attribute__ ((unused)),
-                         int width __attribute__ ((unused)),
-                         Dwarf_Addr *val __attribute__ ((unused)))
-{
-  return 0;
-}
-
-internal_function int
-__libdw_relocate_offset (Dwarf *dbg __attribute__ ((unused)),
-                        int sec_index __attribute__ ((unused)),
-                        uintptr_t addr __attribute__ ((unused)),
-                        int width __attribute__ ((unused)),
-                        Dwarf_Off *val __attribute__ ((unused)))
-{
-  return 0;
-}