mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 08:25:49 +01:00
Mac dump_syms: Fix -a on arm64
- Resets `selected_object_file_` when a new file is read. This was a dangling pointer previously. - When `-a` is provided, ensures that both parts of a split module use the given architecture. Bug: None Change-Id: I581d41b0eee4ec2b0d598fb80b9065e7ebde0e0d Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3788222 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
afc8daa2de
commit
86ea554601
@ -121,6 +121,7 @@ vector<string> list_directory(const string& directory) {
|
|||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
bool DumpSymbols::Read(const string& filename) {
|
bool DumpSymbols::Read(const string& filename) {
|
||||||
|
selected_object_file_ = nullptr;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(filename.c_str(), &st) == -1) {
|
if (stat(filename.c_str(), &st) == -1) {
|
||||||
fprintf(stderr, "Could not access object file %s: %s\n",
|
fprintf(stderr, "Could not access object file %s: %s\n",
|
||||||
|
@ -107,6 +107,35 @@ static void CopyCFIDataBetweenModules(Module* to_module,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool SetArchitecture(DumpSymbols& dump_symbols,
|
||||||
|
const NXArchInfo* arch,
|
||||||
|
const std::string& filename) {
|
||||||
|
if (!dump_symbols.SetArchitecture(arch->cputype, arch->cpusubtype)) {
|
||||||
|
fprintf(stderr, "%s: no architecture '%s' is present in file.\n",
|
||||||
|
filename.c_str(), arch->name);
|
||||||
|
size_t available_size;
|
||||||
|
const SuperFatArch* available =
|
||||||
|
dump_symbols.AvailableArchitectures(&available_size);
|
||||||
|
if (available_size == 1)
|
||||||
|
fprintf(stderr, "the file's architecture is: ");
|
||||||
|
else
|
||||||
|
fprintf(stderr, "architectures present in the file are:\n");
|
||||||
|
for (size_t i = 0; i < available_size; i++) {
|
||||||
|
const SuperFatArch* arch = &available[i];
|
||||||
|
const NXArchInfo* arch_info =
|
||||||
|
google_breakpad::BreakpadGetArchInfoFromCpuType(arch->cputype,
|
||||||
|
arch->cpusubtype);
|
||||||
|
if (arch_info)
|
||||||
|
fprintf(stderr, "%s (%s)\n", arch_info->name, arch_info->description);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "unrecognized cpu type 0x%x, subtype 0x%x\n",
|
||||||
|
arch->cputype, arch->cpusubtype);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool Start(const Options& options) {
|
static bool Start(const Options& options) {
|
||||||
SymbolData symbol_data =
|
SymbolData symbol_data =
|
||||||
(options.handle_inlines ? INLINES : NO_DATA) |
|
(options.handle_inlines ? INLINES : NO_DATA) |
|
||||||
@ -129,31 +158,9 @@ static bool Start(const Options& options) {
|
|||||||
if (!dump_symbols.Read(primary_file))
|
if (!dump_symbols.Read(primary_file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (options.arch) {
|
if (options.arch &&
|
||||||
if (!dump_symbols.SetArchitecture(options.arch->cputype,
|
!SetArchitecture(dump_symbols, options.arch, primary_file)) {
|
||||||
options.arch->cpusubtype)) {
|
return false;
|
||||||
fprintf(stderr, "%s: no architecture '%s' is present in file.\n",
|
|
||||||
primary_file.c_str(), options.arch->name);
|
|
||||||
size_t available_size;
|
|
||||||
const SuperFatArch *available =
|
|
||||||
dump_symbols.AvailableArchitectures(&available_size);
|
|
||||||
if (available_size == 1)
|
|
||||||
fprintf(stderr, "the file's architecture is: ");
|
|
||||||
else
|
|
||||||
fprintf(stderr, "architectures present in the file are:\n");
|
|
||||||
for (size_t i = 0; i < available_size; i++) {
|
|
||||||
const SuperFatArch *arch = &available[i];
|
|
||||||
const NXArchInfo *arch_info =
|
|
||||||
google_breakpad::BreakpadGetArchInfoFromCpuType(
|
|
||||||
arch->cputype, arch->cpusubtype);
|
|
||||||
if (arch_info)
|
|
||||||
fprintf(stderr, "%s (%s)\n", arch_info->name, arch_info->description);
|
|
||||||
else
|
|
||||||
fprintf(stderr, "unrecognized cpu type 0x%x, subtype 0x%x\n",
|
|
||||||
arch->cputype, arch->cpusubtype);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.header_only)
|
if (options.header_only)
|
||||||
@ -171,6 +178,10 @@ static bool Start(const Options& options) {
|
|||||||
if (!dump_symbols.Read(options.srcPath))
|
if (!dump_symbols.Read(options.srcPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (options.arch &&
|
||||||
|
!SetArchitecture(dump_symbols, options.arch, options.srcPath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Module* cfi_module = NULL;
|
Module* cfi_module = NULL;
|
||||||
if (!dump_symbols.ReadSymbolData(&cfi_module))
|
if (!dump_symbols.ReadSymbolData(&cfi_module))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user