namespace implementations of FileID

In trying to create a backend service that can process both ELF and
Mach-O binaries, I found that symbol collisions occur when trying to
link different implementations of FileID. This change puts the
different implementations into separate namespaces to avoid the
collision.

Change-Id: I15aabb222803f2ffbda15ed13e66793bae32ddce
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3421417
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Adam Duke
2022-01-27 17:21:21 -05:00
committed by Mark Mentovai
parent 772cfc1db6
commit f6974b15ef
17 changed files with 34 additions and 11 deletions

View File

@@ -87,11 +87,11 @@ using google_breakpad::DwarfRangeListHandler;
using google_breakpad::ElfClass;
using google_breakpad::ElfClass32;
using google_breakpad::ElfClass64;
using google_breakpad::FileID;
using google_breakpad::elf::FileID;
using google_breakpad::FindElfSectionByName;
using google_breakpad::GetOffset;
using google_breakpad::IsValidElf;
using google_breakpad::kDefaultBuildIdSize;
using google_breakpad::elf::kDefaultBuildIdSize;
using google_breakpad::Module;
using google_breakpad::PageAllocator;
#ifndef NO_STABS_SUPPORT

View File

@@ -49,6 +49,7 @@
#include "third_party/lss/linux_syscall_support.h"
namespace google_breakpad {
namespace elf {
// Used in a few places for backwards-compatibility.
const size_t kMDGUIDSize = sizeof(MDGUID);
@@ -198,4 +199,5 @@ string FileID::ConvertIdentifierToString(
return bytes_to_hex_string(&identifier[0], identifier.size());
}
} // elf
} // namespace google_breakpad

View File

@@ -41,6 +41,7 @@
#include "common/using_std_string.h"
namespace google_breakpad {
namespace elf {
// GNU binutils' ld defaults to 'sha1', which is 160 bits == 20 bytes,
// so this is enough to fit that, which most binaries will use.
@@ -83,6 +84,7 @@ class FileID {
string path_;
};
} // namespace elf
} // namespace google_breakpad
#endif // COMMON_LINUX_FILE_ID_H__

View File

@@ -50,6 +50,8 @@
#include "breakpad_googletest_includes.h"
using namespace google_breakpad;
using google_breakpad::elf::FileID;
using google_breakpad::elf::kDefaultBuildIdSize;
using google_breakpad::synth_elf::ELF;
using google_breakpad::synth_elf::Notes;
using google_breakpad::test_assembler::kLittleEndian;