forked from OSchip/llvm-project
[libunwind] Minor fixes in libunwind
* When _LIBUNWIND_SUPPORT_COMPACT_UNWIND is defined in config.h, define it to "1" like the other macros. These macros are still checked using "#if defined(...)", however. * Include libunwind.h in AddressSpace.hpp before using _LIBUNWIND_ARM_EHABI. * Rename ProcessFrameHeaderCache to TheFrameHeaderCache, because some configurations (e.g. Android / hermetic static libraries) can have one cache per shared object in the process. (When there are more copies, it's more important not to waste memory in the cache.) * Add 3 missing header files to LIBUNWIND_HEADERS. Differential Revision: https://reviews.llvm.org/D86254
This commit is contained in:
parent
5207545a86
commit
7a457593ef
|
@ -17,6 +17,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "libunwind.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "dwarf2.h"
|
||||||
|
#include "EHHeaderParser.hpp"
|
||||||
|
#include "Registers.hpp"
|
||||||
|
|
||||||
#ifndef _LIBUNWIND_USE_DLADDR
|
#ifndef _LIBUNWIND_USE_DLADDR
|
||||||
#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
|
#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
|
||||||
#define _LIBUNWIND_USE_DLADDR 1
|
#define _LIBUNWIND_USE_DLADDR 1
|
||||||
|
@ -39,12 +45,6 @@ struct EHABIIndexEntry {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libunwind.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "dwarf2.h"
|
|
||||||
#include "EHHeaderParser.hpp"
|
|
||||||
#include "Registers.hpp"
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
struct dyld_unwind_sections
|
struct dyld_unwind_sections
|
||||||
|
@ -414,8 +414,9 @@ struct _LIBUNWIND_HIDDEN dl_iterate_cb_data {
|
||||||
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
||||||
#include "FrameHeaderCache.hpp"
|
#include "FrameHeaderCache.hpp"
|
||||||
|
|
||||||
// There should be just one of these per process.
|
// Typically there is one cache per process, but when libunwind is built as a
|
||||||
static FrameHeaderCache ProcessFrameHeaderCache;
|
// hermetic static library, then each shared object may have its own cache.
|
||||||
|
static FrameHeaderCache TheFrameHeaderCache;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool checkAddrInSegment(const Elf_Phdr *phdr, size_t image_base,
|
static bool checkAddrInSegment(const Elf_Phdr *phdr, size_t image_base,
|
||||||
|
@ -438,7 +439,7 @@ static int findUnwindSectionsByPhdr(struct dl_phdr_info *pinfo,
|
||||||
if (pinfo->dlpi_phnum == 0 || cbdata->targetAddr < pinfo->dlpi_addr)
|
if (pinfo->dlpi_phnum == 0 || cbdata->targetAddr < pinfo->dlpi_addr)
|
||||||
return 0;
|
return 0;
|
||||||
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
||||||
if (ProcessFrameHeaderCache.find(pinfo, pinfo_size, data))
|
if (TheFrameHeaderCache.find(pinfo, pinfo_size, data))
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
// Avoid warning about unused variable.
|
// Avoid warning about unused variable.
|
||||||
|
@ -472,7 +473,7 @@ static int findUnwindSectionsByPhdr(struct dl_phdr_info *pinfo,
|
||||||
}
|
}
|
||||||
if (found_obj && found_hdr) {
|
if (found_obj && found_hdr) {
|
||||||
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
|
||||||
ProcessFrameHeaderCache.add(cbdata->sects);
|
TheFrameHeaderCache.add(cbdata->sects);
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,12 @@ set(LIBUNWIND_HEADERS
|
||||||
dwarf2.h
|
dwarf2.h
|
||||||
DwarfInstructions.hpp
|
DwarfInstructions.hpp
|
||||||
DwarfParser.hpp
|
DwarfParser.hpp
|
||||||
|
EHHeaderParser.hpp
|
||||||
|
FrameHeaderCache.hpp
|
||||||
libunwind_ext.h
|
libunwind_ext.h
|
||||||
Registers.hpp
|
Registers.hpp
|
||||||
RWMutex.hpp
|
RWMutex.hpp
|
||||||
|
Unwind-EHABI.h
|
||||||
UnwindCursor.hpp
|
UnwindCursor.hpp
|
||||||
../include/libunwind.h
|
../include/libunwind.h
|
||||||
../include/unwind.h
|
../include/unwind.h
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
// Platform specific configuration defines.
|
// Platform specific configuration defines.
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#if defined(FOR_DYLD)
|
#if defined(FOR_DYLD)
|
||||||
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
|
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
|
||||||
#else
|
#else
|
||||||
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
|
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
|
||||||
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#ifdef __SEH__
|
#ifdef __SEH__
|
||||||
|
|
Loading…
Reference in New Issue