summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asan/asan_rtl.cc8
-rw-r--r--lib/sanitizer_common/CMakeLists.txt1
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer.cc227
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer.h46
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_linux.cc104
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_llvm.cc104
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_mac.cc6
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_win.cc6
8 files changed, 289 insertions, 213 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 3943620a1..661a078e2 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -25,6 +25,7 @@
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_libc.h"
+#include "sanitizer_common/sanitizer_symbolizer.h"
namespace __sanitizer {
using namespace __asan;
@@ -360,6 +361,13 @@ void __asan_init() {
}
InstallSignalHandlers();
+ // Start symbolizer process if necessary.
+ if (flags()->symbolize) {
+ const char *external_symbolizer = GetEnv("ASAN_SYMBOLIZER_PATH");
+ if (external_symbolizer) {
+ InitializeExternalSymbolizer(external_symbolizer);
+ }
+ }
#ifdef _WIN32
__asan_set_symbolize_callback(WinSymbolize);
#endif // _WIN32
diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
index c4126f7e5..5ac8e3b87 100644
--- a/lib/sanitizer_common/CMakeLists.txt
+++ b/lib/sanitizer_common/CMakeLists.txt
@@ -12,7 +12,6 @@ set(SANITIZER_SOURCES
sanitizer_printf.cc
sanitizer_symbolizer.cc
sanitizer_symbolizer_linux.cc
- sanitizer_symbolizer_llvm.cc
sanitizer_symbolizer_mac.cc
sanitizer_symbolizer_win.cc
sanitizer_win.cc
diff --git a/lib/sanitizer_common/sanitizer_symbolizer.cc b/lib/sanitizer_common/sanitizer_symbolizer.cc
index 5bfc957af..7c0b9816f 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer.cc
@@ -12,23 +12,12 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common.h"
+#include "sanitizer_placement_new.h"
#include "sanitizer_procmaps.h"
#include "sanitizer_symbolizer.h"
namespace __sanitizer {
-bool IsFullNameOfDWARFSection(const char *full_name, const char *short_name) {
- // Skip "__DWARF," prefix.
- if (0 == internal_strncmp(full_name, "__DWARF,", 8)) {
- full_name += 8;
- }
- // Skip . and _ prefices.
- while (*full_name == '.' || *full_name == '_') {
- full_name++;
- }
- return 0 == internal_strcmp(full_name, short_name);
-}
-
void AddressInfo::Clear() {
InternalFree(module);
InternalFree(function);
@@ -36,7 +25,7 @@ void AddressInfo::Clear() {
internal_memset(this, 0, sizeof(AddressInfo));
}
-ModuleDIContext::ModuleDIContext(const char *module_name, uptr base_address) {
+LoadedModule::LoadedModule(const char *module_name, uptr base_address) {
full_name_ = internal_strdup(module_name);
short_name_ = internal_strrchr(module_name, '/');
if (short_name_ == 0) {
@@ -46,19 +35,16 @@ ModuleDIContext::ModuleDIContext(const char *module_name, uptr base_address) {
}
base_address_ = base_address;
n_ranges_ = 0;
- mapped_addr_ = 0;
- mapped_size_ = 0;
- dwarf_context_ = 0;
}
-void ModuleDIContext::addAddressRange(uptr beg, uptr end) {
+void LoadedModule::addAddressRange(uptr beg, uptr end) {
CHECK_LT(n_ranges_, kMaxNumberOfAddressRanges);
ranges_[n_ranges_].beg = beg;
ranges_[n_ranges_].end = end;
n_ranges_++;
}
-bool ModuleDIContext::containsAddress(uptr address) const {
+bool LoadedModule::containsAddress(uptr address) const {
for (uptr i = 0; i < n_ranges_; i++) {
if (ranges_[i].beg <= address && address < ranges_[i].end)
return true;
@@ -66,31 +52,136 @@ bool ModuleDIContext::containsAddress(uptr address) const {
return false;
}
-void ModuleDIContext::getAddressInfo(AddressInfo *info) {
- info->module = internal_strdup(full_name_);
- info->module_offset = info->address - base_address_;
- if (mapped_addr_ == 0)
- CreateDWARFContext();
- getLineInfoFromContext(dwarf_context_, info);
+// Extracts the prefix of "str" that consists of any characters not
+// present in "delims" string, and copies this prefix to "result", allocating
+// space for it.
+// Returns a pointer to "str" after skipping extracted prefix and first
+// delimiter char.
+static const char *ExtractToken(const char *str, const char *delims,
+ char **result) {
+ uptr prefix_len = internal_strcspn(str, delims);
+ *result = (char*)InternalAlloc(prefix_len + 1);
+ internal_memcpy(*result, str, prefix_len);
+ (*result)[prefix_len] = '\0';
+ const char *prefix_end = str + prefix_len;
+ if (*prefix_end != '\0') prefix_end++;
+ return prefix_end;
}
-void ModuleDIContext::CreateDWARFContext() {
- mapped_addr_ = (uptr)MapFileToMemory(full_name_, &mapped_size_);
- CHECK(mapped_addr_);
- DWARFSection debug_info;
- DWARFSection debug_abbrev;
- DWARFSection debug_aranges;
- DWARFSection debug_line;
- DWARFSection debug_str;
- FindDWARFSection(mapped_addr_, "debug_info", &debug_info);
- FindDWARFSection(mapped_addr_, "debug_abbrev", &debug_abbrev);
- FindDWARFSection(mapped_addr_, "debug_aranges", &debug_aranges);
- FindDWARFSection(mapped_addr_, "debug_line", &debug_line);
- FindDWARFSection(mapped_addr_, "debug_str", &debug_str);
- dwarf_context_ = getDWARFContext(debug_info, debug_abbrev, debug_aranges,
- debug_line, debug_str);
+// Same as ExtractToken, but converts extracted token to integer.
+static const char *ExtractInt(const char *str, const char *delims,
+ int *result) {
+ char *buff;
+ const char *ret = ExtractToken(str, delims, &buff);
+ if (buff != 0) {
+ *result = internal_atoll(buff);
+ }
+ InternalFree(buff);
+ return ret;
}
+// ExternalSymbolizer encapsulates communication between the tool and
+// external symbolizer program, running in a different subprocess,
+// For now we assume the following protocol:
+// For each request of the form
+// <module_name> <module_offset>
+// passed to STDIN, external symbolizer prints to STDOUT response:
+// <function_name>
+// <file_name>:<line_number>:<column_number>
+// <empty line>
+class ExternalSymbolizer {
+ public:
+ ExternalSymbolizer(const char *path, int input_fd, int output_fd)
+ : path_(path),
+ input_fd_(input_fd),
+ output_fd_(output_fd),
+ times_restarted_(0) {
+ CHECK(path_);
+ CHECK_NE(input_fd_, kInvalidFd);
+ CHECK_NE(output_fd_, kInvalidFd);
+ }
+ bool getFileLineInfo(const char *module, uptr module_offset,
+ AddressInfo *info) {
+ CHECK(module);
+ // FIXME: Make sure this buffer always has sufficient size to hold
+ // large debug info.
+ static const int kMaxBufferSize = 1024;
+ InternalScopedBuffer<char> buffer(kMaxBufferSize);
+ internal_snprintf(buffer, kMaxBufferSize, "%s %zu\n",
+ module, module_offset);
+ // FIXME: If read/write fails, we should try to respawn symbolizer
+ // subprocess.
+ if (!writeToSymbolizer(buffer, internal_strlen(buffer)))
+ return false;
+ if (!readFromSymbolizer(buffer, kMaxBufferSize))
+ return false;
+ const char *str = buffer.data();
+ str = ExtractToken(str, "\n", &info->function);
+ str = ExtractToken(str, ":\n", &info->file);
+ str = ExtractInt(str, ":\n", &info->line);
+ str = ExtractInt(str, ":\n", &info->column);
+ // Functions and filenames can be "??", in which case we write 0 to address
+ // info to mark that names are unknown.
+ if (0 == internal_strcmp(info->function, "??")) {
+ InternalFree(info->function);
+ info->function = 0;
+ }
+ if (0 == internal_strcmp(info->file, "??")) {
+ InternalFree(info->file);
+ info->file = 0;
+ }
+ return true;
+ }
+ bool Restart() {
+ if (times_restarted_ >= kMaxTimesRestarted) return false;
+ times_restarted_++;
+ internal_close(input_fd_);
+ internal_close(output_fd_);
+ return StartSymbolizerSubprocess(path_, &input_fd_, &output_fd_);
+ }
+
+ private:
+ bool readFromSymbolizer(char *buffer, uptr max_length) {
+ if (max_length == 0)
+ return true;
+ uptr read_len = 0;
+ while (true) {
+ uptr just_read = internal_read(input_fd_, buffer + read_len,
+ max_length - read_len);
+ // We can't read 0 bytes, as we don't expect external symbolizer to close
+ // its stdout.
+ if (just_read == 0 || just_read == (uptr)-1) {
+ Report("WARNING: Can't read from symbolizer at fd %d\n", input_fd_);
+ return false;
+ }
+ read_len += just_read;
+ // Empty line marks the end of symbolizer output.
+ if (read_len >= 2 && buffer[read_len - 1] == '\n' &&
+ buffer[read_len - 2] == '\n') {
+ break;
+ }
+ }
+ return true;
+ }
+ bool writeToSymbolizer(const char *buffer, uptr length) {
+ if (length == 0)
+ return true;
+ uptr write_len = internal_write(output_fd_, buffer, length);
+ if (write_len == 0 || write_len == (uptr)-1) {
+ Report("WARNING: Can't write to symbolizer at fd %d\n", output_fd_);
+ return false;
+ }
+ return true;
+ }
+
+ const char *path_;
+ int input_fd_;
+ int output_fd_;
+
+ static const uptr kMaxTimesRestarted = 5;
+ uptr times_restarted_;
+};
+
class Symbolizer {
public:
uptr SymbolizeCode(uptr addr, AddressInfo *frames, uptr max_frames) {
@@ -99,19 +190,47 @@ class Symbolizer {
AddressInfo *info = &frames[0];
info->Clear();
info->address = addr;
- ModuleDIContext *module = FindModuleForAddress(addr);
+ LoadedModule *module = FindModuleForAddress(addr);
if (module) {
- module->getAddressInfo(info);
+ info->module = internal_strdup(module->full_name());
+ info->module_offset = info->address - module->base_address();
+ if (external_symbolizer_ == 0) {
+ ReportExternalSymbolizerError(
+ "WARNING: Trying to symbolize code, but external "
+ "symbolizer is not initialized!\n");
+ } else {
+ while (!external_symbolizer_->getFileLineInfo(
+ info->module, info->module_offset, info)) {
+ // Try to restart symbolizer subprocess. If we don't succeed, forget
+ // about it and don't try to use it later.
+ if (!external_symbolizer_->Restart()) {
+ ReportExternalSymbolizerError(
+ "WARNING: Failed to use and restart external symbolizer!\n");
+ InternalFree(external_symbolizer_);
+ external_symbolizer_ = 0;
+ break;
+ }
+ }
+ }
return 1;
}
return 0;
}
+ bool InitializeExternalSymbolizer(const char *path_to_symbolizer) {
+ int input_fd, output_fd;
+ if (!StartSymbolizerSubprocess(path_to_symbolizer, &input_fd, &output_fd))
+ return false;
+ void *mem = InternalAlloc(sizeof(ExternalSymbolizer));
+ external_symbolizer_ = new(mem) ExternalSymbolizer(path_to_symbolizer,
+ input_fd, output_fd);
+ return true;
+ }
private:
- ModuleDIContext *FindModuleForAddress(uptr address) {
+ LoadedModule *FindModuleForAddress(uptr address) {
if (modules_ == 0) {
- modules_ = (ModuleDIContext*)InternalAlloc(
- kMaxNumberOfModuleContexts * sizeof(ModuleDIContext));
+ modules_ = (LoadedModule*)InternalAlloc(
+ kMaxNumberOfModuleContexts * sizeof(LoadedModule));
CHECK(modules_);
n_modules_ = GetListOfModules(modules_, kMaxNumberOfModuleContexts);
CHECK_GT(n_modules_, 0);
@@ -124,10 +243,22 @@ class Symbolizer {
}
return 0;
}
+ void ReportExternalSymbolizerError(const char *msg) {
+ // Don't use atomics here for now, as SymbolizeCode can't be called
+ // from multiple threads anyway.
+ static bool reported;
+ if (!reported) {
+ Report(msg);
+ reported = true;
+ }
+ }
+
static const uptr kMaxNumberOfModuleContexts = 4096;
- // Array of module debug info contexts is leaked.
- ModuleDIContext *modules_;
+ // Array of module descriptions is leaked.
+ LoadedModule *modules_;
uptr n_modules_;
+
+ ExternalSymbolizer *external_symbolizer_;
};
static Symbolizer symbolizer; // Linker initialized.
@@ -136,4 +267,8 @@ uptr SymbolizeCode(uptr address, AddressInfo *frames, uptr max_frames) {
return symbolizer.SymbolizeCode(address, frames, max_frames);
}
+bool InitializeExternalSymbolizer(const char *path_to_symbolizer) {
+ return symbolizer.InitializeExternalSymbolizer(path_to_symbolizer);
+}
+
} // namespace __sanitizer
diff --git a/lib/sanitizer_common/sanitizer_symbolizer.h b/lib/sanitizer_common/sanitizer_symbolizer.h
index d5574b244..482222add 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer.h
+++ b/lib/sanitizer_common/sanitizer_symbolizer.h
@@ -52,40 +52,20 @@ struct AddressInfo {
// This function should NOT be called from two threads simultaneously.
uptr SymbolizeCode(uptr address, AddressInfo *frames, uptr max_frames);
-// Debug info routines
-struct DWARFSection {
- const char *data;
- uptr size;
- DWARFSection() {
- data = 0;
- size = 0;
- }
-};
-// Returns true on success.
-bool FindDWARFSection(uptr object_file_addr, const char *section_name,
- DWARFSection *section);
-bool IsFullNameOfDWARFSection(const char *full_name, const char *short_name);
-
-class DWARFContext;
-DWARFContext *getDWARFContext(DWARFSection debug_info,
- DWARFSection debug_abbrev,
- DWARFSection debug_aranges,
- DWARFSection debug_line,
- DWARFSection debug_str);
-void getLineInfoFromContext(DWARFContext *context, AddressInfo *info);
+// Starts external symbolizer program in a subprocess. Sanitizer communicates
+// with external symbolizer via pipes.
+bool InitializeExternalSymbolizer(const char *path_to_symbolizer);
-class ModuleDIContext {
+class LoadedModule {
public:
- ModuleDIContext(const char *module_name, uptr base_address);
+ LoadedModule(const char *module_name, uptr base_address);
void addAddressRange(uptr beg, uptr end);
bool containsAddress(uptr address) const;
- void getAddressInfo(AddressInfo *info);
const char *full_name() const { return full_name_; }
+ uptr base_address() const { return base_address_; }
private:
- void CreateDWARFContext();
-
struct AddressRange {
uptr beg;
uptr end;
@@ -96,13 +76,17 @@ class ModuleDIContext {
static const uptr kMaxNumberOfAddressRanges = 8;
AddressRange ranges_[kMaxNumberOfAddressRanges];
uptr n_ranges_;
- uptr mapped_addr_;
- uptr mapped_size_;
- DWARFContext *dwarf_context_;
};
-// OS-dependent function that gets the linked list of all loaded modules.
-uptr GetListOfModules(ModuleDIContext *modules, uptr max_modules);
+// Creates external symbolizer connected via pipe, user should write
+// to output_fd and read from input_fd.
+bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
+ int *input_fd, int *output_fd);
+
+// OS-dependent function that fills array with descriptions of at most
+// "max_modules" currently loaded modules. Returns the number of
+// initialized modules.
+uptr GetListOfModules(LoadedModule *modules, uptr max_modules);
} // namespace __sanitizer
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_linux.cc b/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
index c05bed34b..0a300007e 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
@@ -14,46 +14,100 @@
#ifdef __linux__
#include "sanitizer_common.h"
#include "sanitizer_internal_defs.h"
+#include "sanitizer_libc.h"
#include "sanitizer_placement_new.h"
#include "sanitizer_symbolizer.h"
#include <elf.h>
+#include <errno.h>
#include <link.h>
+#include <poll.h>
+#include <sys/socket.h>
+#include <sys/types.h>
#include <unistd.h>
namespace __sanitizer {
-typedef ElfW(Ehdr) Elf_Ehdr;
-typedef ElfW(Shdr) Elf_Shdr;
-typedef ElfW(Phdr) Elf_Phdr;
-
-bool FindDWARFSection(uptr object_file_addr, const char *section_name,
- DWARFSection *section) {
- Elf_Ehdr *exe = (Elf_Ehdr*)object_file_addr;
- Elf_Shdr *sections = (Elf_Shdr*)(object_file_addr + exe->e_shoff);
- uptr section_names = object_file_addr +
- sections[exe->e_shstrndx].sh_offset;
- for (int i = 0; i < exe->e_shnum; i++) {
- Elf_Shdr *current_section = &sections[i];
- const char *current_name = (const char*)section_names +
- current_section->sh_name;
- if (IsFullNameOfDWARFSection(current_name, section_name)) {
- section->data = (const char*)object_file_addr +
- current_section->sh_offset;
- section->size = current_section->sh_size;
- return true;
+bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
+ int *input_fd, int *output_fd) {
+ int *infd = NULL;
+ int *outfd = NULL;
+ // The client program may close its stdin and/or stdout and/or stderr
+ // thus allowing socketpair to reuse file descriptors 0, 1 or 2.
+ // In this case the communication between the forked processes may be
+ // broken if either the parent or the child tries to close or duplicate
+ // these descriptors. The loop below produces two pairs of file
+ // descriptors, each greater than 2 (stderr).
+ int sock_pair[5][2];
+ for (int i = 0; i < 5; i++) {
+ if (pipe(sock_pair[i]) == -1) {
+ for (int j = 0; j < i; j++) {
+ internal_close(sock_pair[j][0]);
+ internal_close(sock_pair[j][1]);
+ }
+ Report("WARNING: Can't create a socket pair to start "
+ "external symbolizer (errno: %d)\n", errno);
+ return false;
+ } else if (sock_pair[i][0] > 2 && sock_pair[i][1] > 2) {
+ if (infd == NULL) {
+ infd = sock_pair[i];
+ } else {
+ outfd = sock_pair[i];
+ for (int j = 0; j < i; j++) {
+ if (sock_pair[j] == infd) continue;
+ internal_close(sock_pair[j][0]);
+ internal_close(sock_pair[j][1]);
+ }
+ break;
+ }
}
}
- return false;
+ CHECK(infd);
+ CHECK(outfd);
+
+ int pid = fork();
+ if (pid == -1) {
+ // Fork() failed.
+ internal_close(infd[0]);
+ internal_close(infd[1]);
+ internal_close(outfd[0]);
+ internal_close(outfd[1]);
+ Report("WARNING: failed to fork external symbolizer "
+ " (errno: %d)\n", errno);
+ return false;
+ } else if (pid == 0) {
+ // Child subprocess.
+ internal_close(STDOUT_FILENO);
+ internal_close(STDIN_FILENO);
+ internal_dup2(outfd[0], STDIN_FILENO);
+ internal_dup2(infd[1], STDOUT_FILENO);
+ internal_close(outfd[0]);
+ internal_close(outfd[1]);
+ internal_close(infd[0]);
+ internal_close(infd[1]);
+ for (int fd = getdtablesize(); fd > 2; fd--)
+ internal_close(fd);
+ execl(path_to_symbolizer, path_to_symbolizer, (char*)0);
+ Exit(1);
+ }
+
+ // Continue execution in parent process.
+ internal_close(outfd[0]);
+ internal_close(infd[1]);
+ *input_fd = infd[0];
+ *output_fd = outfd[1];
+ return true;
}
#ifdef ANDROID
-uptr GetListOfModules(ModuleDIContext *modules, uptr max_modules) {
+uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
UNIMPLEMENTED();
}
#else // ANDROID
+typedef ElfW(Phdr) Elf_Phdr;
+
struct DlIteratePhdrData {
- ModuleDIContext *modules;
+ LoadedModule *modules;
uptr current_n;
uptr max_n;
};
@@ -79,8 +133,8 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
if (module_name == 0 || module_name[0] == '\0')
return 0;
void *mem = &data->modules[data->current_n];
- ModuleDIContext *cur_module = new(mem) ModuleDIContext(module_name,
- info->dlpi_addr);
+ LoadedModule *cur_module = new(mem) LoadedModule(module_name,
+ info->dlpi_addr);
data->current_n++;
for (int i = 0; i < info->dlpi_phnum; i++) {
const Elf_Phdr *phdr = &info->dlpi_phdr[i];
@@ -94,7 +148,7 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
return 0;
}
-uptr GetListOfModules(ModuleDIContext *modules, uptr max_modules) {
+uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
CHECK(modules);
DlIteratePhdrData data = {modules, 0, max_modules};
dl_iterate_phdr(dl_iterate_phdr_cb, &data);
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_llvm.cc b/lib/sanitizer_common/sanitizer_symbolizer_llvm.cc
deleted file mode 100644
index 5dd1ad8dd..000000000
--- a/lib/sanitizer_common/sanitizer_symbolizer_llvm.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-//===-- sanitizer_symbolizer_llvm.cc --------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a wrapper around llvm::DIContext, moved to separate file to
-// include LLVM headers in a single place in sanitizer library. If macro
-// SANITIZER_USES_LLVM_LIBS is not defined, then sanitizer runtime
-// will not include LLVM headers and will not require static
-// LLVM libraries to link with.
-// In this case, the symbolizer will just return zeroes instead of
-// valid file/line info.
-//
-// This file is shared between AddressSanitizer and ThreadSanitizer
-// run-time libraries.
-//===----------------------------------------------------------------------===//
-
-#include "sanitizer_common.h"
-#include "sanitizer_symbolizer.h"
-
-#ifdef SANITIZER_USES_LLVM_LIBS
-# ifndef __STDC_LIMIT_MACROS
-# define __STDC_LIMIT_MACROS 1
-# endif
-# ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS 1
-# endif
-# include "llvm/ADT/StringRef.h"
-# include "llvm/DebugInfo/DIContext.h"
-
-namespace __sanitizer {
-
-static llvm::StringRef ToStringRef(const DWARFSection &section) {
- return llvm::StringRef(section.data, section.size);
-}
-
-class DWARFContext : public llvm::DIContext {};
-
-DWARFContext *getDWARFContext(DWARFSection debug_info,
- DWARFSection debug_abbrev,
- DWARFSection debug_aranges,
- DWARFSection debug_line,
- DWARFSection debug_str) {
- return (DWARFContext*)llvm::DIContext::getDWARFContext(
- true, ToStringRef(debug_info), ToStringRef(debug_abbrev),
- llvm::StringRef(), // don't use .debug_aranges for now.
- ToStringRef(debug_line), ToStringRef(debug_str));
-}
-
-void getLineInfoFromContext(DWARFContext *context, AddressInfo *info) {
- CHECK(context);
- uint32_t flags = llvm::DILineInfoSpecifier::FileLineInfo |
- llvm::DILineInfoSpecifier::AbsoluteFilePath |
- llvm::DILineInfoSpecifier::FunctionName;
- llvm::DILineInfo line_info = context->getLineInfoForAddress(
- info->module_offset, flags);
-
- const char *function = line_info.getFunctionName();
- CHECK(function);
- if (0 != internal_strcmp("<invalid>", function))
- info->function = internal_strdup(function);
- else
- info->function = 0;
-
- const char *file = line_info.getFileName();
- CHECK(file);
- if (0 != internal_strcmp("<invalid>", file))
- info->file = internal_strdup(file);
- else
- info->file = 0;
-
- info->line = line_info.getLine();
- info->column = line_info.getColumn();
-}
-
-} // namespace __sanitizer
-
-#else // SANITIZER_USES_LLVM_LIBS
-namespace __sanitizer {
-
-class DWARFContext {};
-
-DWARFContext *getDWARFContext(DWARFSection debug_info,
- DWARFSection debug_abbrev,
- DWARFSection debug_aranges,
- DWARFSection debug_line,
- DWARFSection debug_str) {
- return 0;
-}
-
-void getLineInfoFromContext(DWARFContext *context, AddressInfo *info) {
- (void)context;
- info->function = 0;
- info->file = 0;
- info->line = 0;
- info->column = 0;
-}
-
-} // namespace __sanitizer
-#endif // SANITIZER_USES_LLVM_LIBS
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc b/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
index d8445d97d..23d4f8166 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
@@ -17,13 +17,13 @@
namespace __sanitizer {
-bool FindDWARFSection(uptr object_file_addr, const char *section_name,
- DWARFSection *section) {
+bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
+ int *input_fd, int *output_fd) {
UNIMPLEMENTED();
return false;
}
-uptr GetListOfModules(ModuleDIContext *modules, uptr max_modules) {
+uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
UNIMPLEMENTED();
return 0;
}
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_win.cc b/lib/sanitizer_common/sanitizer_symbolizer_win.cc
index 39c3ad173..84fc9d777 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_win.cc
@@ -19,13 +19,13 @@
namespace __sanitizer {
-bool FindDWARFSection(uptr object_file_addr, const char *section_name,
- DWARFSection *section) {
+bool StartSymbolizerSubprocess(const char *path_to_symbolizer,
+ int *input_fd, int *output_fd) {
UNIMPLEMENTED();
return false;
}
-uptr GetListOfModules(ModuleDIContext *modules, uptr max_modules) {
+uptr GetListOfModules(LoadedModule *modules, uptr max_modules) {
UNIMPLEMENTED();
return 0;
};