summaryrefslogtreecommitdiffstats
path: root/0.153
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2013-11-20 15:54:16 -0800
committerBen Cheng <bccheng@google.com>2013-11-20 15:54:16 -0800
commit65b3819bcdc2ecbfec9e718d121af9f5fe614069 (patch)
tree667837d069368f6aa027aae8d746e69b40703495 /0.153
parentc627a2d7a2de93e6c8dd950b13afcedb1e224226 (diff)
downloadandroid_external_elfutils-65b3819bcdc2ecbfec9e718d121af9f5fe614069.tar.gz
android_external_elfutils-65b3819bcdc2ecbfec9e718d121af9f5fe614069.tar.bz2
android_external_elfutils-65b3819bcdc2ecbfec9e718d121af9f5fe614069.zip
Add patches required by Bionic and MacOS.
Change-Id: I75c6cf9ffd783c5675e9808fc8c070a2ea865868
Diffstat (limited to '0.153')
-rw-r--r--0.153/bionic-fixup/AndroidFixup.h83
-rw-r--r--0.153/bionic-fixup/argp.h22
-rw-r--r--0.153/bionic-fixup/error.h36
-rw-r--r--0.153/bionic-fixup/libintl.h22
-rw-r--r--0.153/bionic-fixup/stdio_ext.h22
-rw-r--r--0.153/config.h65
-rw-r--r--0.153/host-darwin-fixup/AndroidFixup.h97
-rw-r--r--0.153/host-darwin-fixup/argp.h22
-rw-r--r--0.153/host-darwin-fixup/byteswap.h37
-rw-r--r--0.153/host-darwin-fixup/endian.h24
-rw-r--r--0.153/host-darwin-fixup/error.h22
-rw-r--r--0.153/host-darwin-fixup/libintl.h22
-rw-r--r--0.153/host-linux-fixup/AndroidFixup.h22
-rw-r--r--0.153/libdwfl/dwfl_build_id_find_elf.c9
-rw-r--r--0.153/libdwfl/dwfl_error.c5
-rw-r--r--0.153/libdwfl/find-debuginfo.c23
16 files changed, 533 insertions, 0 deletions
diff --git a/0.153/bionic-fixup/AndroidFixup.h b/0.153/bionic-fixup/AndroidFixup.h
new file mode 100644
index 00000000..6a58eda3
--- /dev/null
+++ b/0.153/bionic-fixup/AndroidFixup.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_FIXUP_H
+#define ANDROID_FIXUP_H
+
+#include <stdio.h>
+#include <libgen.h> // for basename
+
+#define off_t loff_t
+
+#ifndef MAX
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#endif
+
+#ifndef MIN
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#endif
+
+#ifndef powerof2
+#define powerof2(x) (((x - 1) & (x)) == 0)
+#endif
+
+/* workaround for canonicalize_file_name */
+#define canonicalize_file_name(path) realpath(path, NULL)
+
+/* workaround for open64 */
+#define open64(path, flags) open(path, ((flags) | O_LARGEFILE))
+
+/* no internalization */
+#define gettext(x) (x)
+
+/* _mempcpy and mempcpy */
+#ifndef __mempcpy
+#define __mempcpy(dest, src, n) mempcpy(dest, src, n)
+#endif
+
+#ifndef mempcpy
+#include <string.h>
+
+static inline void *mempcpy(void *dest, const void *src, size_t n)
+{
+ char *ptr = memcpy(dest, src, n);
+ return ptr + n;
+}
+#endif
+
+/* rawmemchr */
+static inline void *rawmemchr(const void *s, int c)
+{
+ const unsigned char *ptr = s;
+ while (1) {
+ if (*ptr == c) return (void *) ptr;
+ ptr++;
+ }
+}
+
+/* workaround for stpcpy */
+static inline char *stpcpy(char *dst, const char *src)
+{
+ while (*src) {
+ *dst++ = *src++;
+ }
+ return dst;
+}
+
+/* forward declarations */
+char * dgettext (const char * domainname, const char * msgid);
+
+#endif /* ANDROID_FIXUP_H */
diff --git a/0.153/bionic-fixup/argp.h b/0.153/bionic-fixup/argp.h
new file mode 100644
index 00000000..8a8e1bbe
--- /dev/null
+++ b/0.153/bionic-fixup/argp.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_ARGP_H
+#define ELFUTILS_ARGP_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_ARGP_H */
diff --git a/0.153/bionic-fixup/error.h b/0.153/bionic-fixup/error.h
new file mode 100644
index 00000000..1fcd9378
--- /dev/null
+++ b/0.153/bionic-fixup/error.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_ERROR_H
+#define ELFUTILS_ERROR_H
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static inline void __attribute__((noreturn))
+error(int status, int errnum, const char *fmt, ...)
+{
+ va_list lst;
+ va_start(lst, fmt);
+ vfprintf(stderr, fmt, lst);
+ fprintf(stderr, "error %d: %s\n", errnum, strerror(errno));
+ va_end(lst);
+ exit(status);
+}
+
+#endif /* ELFUTILS_ERROR_H */
diff --git a/0.153/bionic-fixup/libintl.h b/0.153/bionic-fixup/libintl.h
new file mode 100644
index 00000000..fe943486
--- /dev/null
+++ b/0.153/bionic-fixup/libintl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_LIBINTL_H
+#define ELFUTILS_LIBINTL_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_LIBINTL_H */
diff --git a/0.153/bionic-fixup/stdio_ext.h b/0.153/bionic-fixup/stdio_ext.h
new file mode 100644
index 00000000..254e19b0
--- /dev/null
+++ b/0.153/bionic-fixup/stdio_ext.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_BIONIC_FIXUP_STDIO_EXT_H
+#define ELFUTILS_BIONIC_FIXUP_STDIO_EXT_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_BIONIC_FIXUP_STDIO_EXT_H */
diff --git a/0.153/config.h b/0.153/config.h
new file mode 100644
index 00000000..19253335
--- /dev/null
+++ b/0.153/config.h
@@ -0,0 +1,65 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Should ar and ranlib use -D behavior by default? */
+#define DEFAULT_AR_DETERMINISTIC false
+
+/* $libdir subdirectory containing libebl modules. */
+#define LIBEBL_SUBDIR "elfutils"
+
+/* Identifier for modules in the build. */
+#define MODVERSION "Build on bccheng.mtv.corp.google.com 2013-11-20T14:06:10-0800"
+
+/* Define to 32 or 64 if a specific implementation is wanted. */
+/* #undef NATIVE_ELF */
+
+/* Name of package */
+#define PACKAGE "elfutils"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://bugzilla.redhat.com/bugzilla/"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "Red Hat elfutils"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "Red Hat elfutils 0.153"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "elfutils"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.153"
+
+/* Support bzip2 decompression via -lbz2. */
+/* #undef USE_BZLIB */
+
+/* Defined if demangling is enabled */
+#define USE_DEMANGLE 1
+
+/* Defined if libraries should be thread-safe. */
+/* #undef USE_LOCKS */
+
+/* Support LZMA (xz) decompression via -llzma. */
+/* #undef USE_LZMA */
+
+/* Support gzip decompression via -lz. */
+/* #undef USE_ZLIB */
+
+/* Version number of package */
+#define VERSION "0.153"
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+#define YYTEXT_POINTER 1
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+#include <eu-config.h>
diff --git a/0.153/host-darwin-fixup/AndroidFixup.h b/0.153/host-darwin-fixup/AndroidFixup.h
new file mode 100644
index 00000000..0d43c0bc
--- /dev/null
+++ b/0.153/host-darwin-fixup/AndroidFixup.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_FIXUP_H
+#define ANDROID_FIXUP_H
+
+#define loff_t off_t
+#define off64_t off_t
+
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <locale.h> //LC_MESSAGES
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ typeof (exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (_rc == -1 && errno == EINTR); \
+ _rc; })
+#endif
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+static inline size_t strnlen (const char *__string, size_t __maxlen)
+{
+ int len = 0;
+ while (__maxlen-- && *__string++)
+ len++;
+ return len;
+}
+#endif
+
+static inline void *mempcpy (void * __dest, const void * __src, size_t __n)
+{
+ memcpy(__dest, __src, __n);
+ return ((char *)__dest) + __n;
+}
+
+#define __mempcpy mempcpy
+
+#define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
+
+static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...)
+{
+ va_list lst;
+ va_start(lst, fmt);
+ vfprintf(stderr, fmt, lst);
+ fprintf(stderr, "error %d: %s\n", errnum, strerror(errno));
+ va_end(lst);
+ exit(status);
+}
+
+static inline char *dcgettext (char *__domainname, char *__msgid, int __category)
+{
+ error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__);
+ return NULL;
+}
+
+/* workaround for canonicalize_file_name */
+#define canonicalize_file_name(path) realpath(path, NULL)
+
+/* workaround for open64 */
+#define open64(path, flags) open(path, flags)
+
+/* rawmemchr */
+static inline void *rawmemchr(const void *s, int c)
+{
+ const unsigned char *ptr = s;
+ while (1) {
+ if (*ptr == c) return (void *) ptr;
+ ptr++;
+ }
+}
+
+#define strndup(str, size) strdup(str)
+
+static void tdestroy(void *root, void (*free_node)(void *nodep))
+{
+}
+
+#endif /* ANDROID_FIXUP_H */
diff --git a/0.153/host-darwin-fixup/argp.h b/0.153/host-darwin-fixup/argp.h
new file mode 100644
index 00000000..8a8e1bbe
--- /dev/null
+++ b/0.153/host-darwin-fixup/argp.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_ARGP_H
+#define ELFUTILS_ARGP_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_ARGP_H */
diff --git a/0.153/host-darwin-fixup/byteswap.h b/0.153/host-darwin-fixup/byteswap.h
new file mode 100644
index 00000000..a8d27d4f
--- /dev/null
+++ b/0.153/host-darwin-fixup/byteswap.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_BYTESWAP_H
+#define ELFUTILS_BYTESWAP_H
+
+static inline unsigned short bswap_16(unsigned short val)
+{
+ return ((val & 0xff) << 8) | ((val >> 8) & 0xff);
+}
+
+static inline unsigned long bswap_32(unsigned long val)
+{
+ return bswap_16((unsigned short)val) << 16 |
+ bswap_16((unsigned short)(val >> 16));
+}
+
+static inline unsigned long long bswap_64(unsigned long long val)
+{
+ return ((((unsigned long long)bswap_32(val)) << 32) |
+ (((unsigned long long)bswap_32(val >> 32)) & 0xffffffffULL));
+}
+
+#endif /* ELFUTILS_BYTESWAP_H */
diff --git a/0.153/host-darwin-fixup/endian.h b/0.153/host-darwin-fixup/endian.h
new file mode 100644
index 00000000..14bb32df
--- /dev/null
+++ b/0.153/host-darwin-fixup/endian.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_ENDIAN_H
+#define ELFUTILS_ENDIAN_H
+
+#define __LITTLE_ENDIAN (1234)
+#define __BIG_ENDIAN (4321)
+#define __BYTE_ORDER __LITTLE_ENDIAN
+
+#endif /* ELFUTILS_ENDIAN_H */
diff --git a/0.153/host-darwin-fixup/error.h b/0.153/host-darwin-fixup/error.h
new file mode 100644
index 00000000..3c9569fd
--- /dev/null
+++ b/0.153/host-darwin-fixup/error.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_ERROR_H
+#define ELFUTILS_ERROR_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_ERROR_H */
diff --git a/0.153/host-darwin-fixup/libintl.h b/0.153/host-darwin-fixup/libintl.h
new file mode 100644
index 00000000..fe943486
--- /dev/null
+++ b/0.153/host-darwin-fixup/libintl.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ELFUTILS_LIBINTL_H
+#define ELFUTILS_LIBINTL_H
+
+/* intentionally blank */
+
+#endif /* ELFUTILS_LIBINTL_H */
diff --git a/0.153/host-linux-fixup/AndroidFixup.h b/0.153/host-linux-fixup/AndroidFixup.h
new file mode 100644
index 00000000..ea4d5a1f
--- /dev/null
+++ b/0.153/host-linux-fixup/AndroidFixup.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_FIXUP_H
+#define ANDROID_FIXUP_H
+
+/* intentionally blank */
+
+#endif /* ANDROID_FIXUP_H */
diff --git a/0.153/libdwfl/dwfl_build_id_find_elf.c b/0.153/libdwfl/dwfl_build_id_find_elf.c
index e27c8e12..12ce1b58 100644
--- a/0.153/libdwfl/dwfl_build_id_find_elf.c
+++ b/0.153/libdwfl/dwfl_build_id_find_elf.c
@@ -84,8 +84,13 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name)
".debug");
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
+#if defined(__BIONIC__) || defined(__APPLE__)
+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+#else
char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
?: DEFAULT_DEBUGINFO_PATH);
+#endif
int fd = -1;
char *dir;
@@ -119,6 +124,10 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name)
free (name);
}
+#if defined(__BIONIC__) || defined(__APPLE__)
+ free(path);
+#endif
+
/* If we simply found nothing, clear errno. If we had some other error
with the file, report that. Possibly this should treat other errors
like ENOENT too. But ignoring all errors could mask some that should
diff --git a/0.153/libdwfl/dwfl_error.c b/0.153/libdwfl/dwfl_error.c
index 9144a378..a73d6670 100644
--- a/0.153/libdwfl/dwfl_error.c
+++ b/0.153/libdwfl/dwfl_error.c
@@ -163,7 +163,12 @@ dwfl_errmsg (error)
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
+#ifdef __BIONIC__
+ strerror_r (error & 0xffff, "bad", 0);
+ return "bad";
+#else
return strerror_r (error & 0xffff, "bad", 0);
+#endif
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):
diff --git a/0.153/libdwfl/find-debuginfo.c b/0.153/libdwfl/find-debuginfo.c
index f6f802e2..12cfe636 100644
--- a/0.153/libdwfl/find-debuginfo.c
+++ b/0.153/libdwfl/find-debuginfo.c
@@ -163,8 +163,13 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
indicated by the debug directory path setting. */
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
+#if defined(__BIONIC__) || defined(__APPLE__)
+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+#else
char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
?: DEFAULT_DEBUGINFO_PATH);
+#endif
/* A leading - or + in the whole path sets whether to check file CRCs. */
bool defcheck = true;
@@ -184,8 +189,14 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
main_stat.st_ino = 0;
}
+#if defined(__BIONIC__) || defined(__APPLE__)
+ char *file_dirname = (file_basename == file_name ? NULL
+ : strndup (file_name, file_basename - 1 - file_name));
+#else
char *file_dirname = (file_basename == file_name ? NULL
: strndupa (file_name, file_basename - 1 - file_name));
+#endif
+
char *p;
while ((p = strsep (&path, ":")) != NULL)
{
@@ -229,11 +240,19 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
case ENOTDIR:
continue;
default:
+#if defined(__BIONIC__) || defined(__APPLE__)
+ free(path);
+ free(file_dirname);
+#endif
return -1;
}
if (validate (mod, fd, check, debuglink_crc))
{
*debuginfo_file_name = fname;
+#if defined(__BIONIC__) || defined(__APPLE__)
+ free(path);
+ free(file_dirname);
+#endif
return fd;
}
free (fname);
@@ -242,6 +261,10 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
/* No dice. */
errno = 0;
+#if defined(__BIONIC__) || defined(__APPLE__)
+ free(path);
+ free(file_dirname);
+#endif
return -1;
}