aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-04-13 13:02:45 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-04-13 14:08:19 -0700
commit0e5cdbf07e6d45ca168a76b2bc19b6e385cfae17 (patch)
tree5b20dce631e3d40a341873778b0cef8674258775 /lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
parent7fc0b3049df532fce726d1ff6869a9f6e3183780 (diff)
downloadllvm-0e5cdbf07e6d45ca168a76b2bc19b6e385cfae17.zip
llvm-0e5cdbf07e6d45ca168a76b2bc19b6e385cfae17.tar.gz
llvm-0e5cdbf07e6d45ca168a76b2bc19b6e385cfae17.tar.bz2
[lldb] Make ObjectFileJSON loadable as a module
This patch adds support for creating modules from JSON object files. This is necessary for the crashlog use case where we don't have either a module or a symbol file. In that case the ObjectFileJSON serves as both. The patch adds support for an object file type (i.e. executable, shared library, etc). It also adds the ability to specify sections, which is necessary in order specify symbols by address. Finally, this patch improves error handling and fixes a bug where we wouldn't read more than the initial 512 bytes in GetModuleSpecifications. Differential revision: https://reviews.llvm.org/D148062
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h')
-rw-r--r--lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
index cb3a7d2..b72565f 100644
--- a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
+++ b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.h
@@ -82,7 +82,7 @@ public:
uint32_t GetDependentModules(FileSpecList &files) override { return 0; }
- Type CalculateType() override { return eTypeDebugInfo; }
+ Type CalculateType() override { return m_type; }
Strata CalculateStrata() override { return eStrataUser; }
@@ -92,21 +92,27 @@ public:
struct Header {
std::string triple;
std::string uuid;
+ std::optional<ObjectFile::Type> type;
};
struct Body {
+ std::vector<JSONSection> sections;
std::vector<JSONSymbol> symbols;
};
private:
ArchSpec m_arch;
UUID m_uuid;
+ ObjectFile::Type m_type;
+ std::optional<uint64_t> m_size;
std::vector<JSONSymbol> m_symbols;
+ std::vector<JSONSection> m_sections;
ObjectFileJSON(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::offset_t data_offset, const FileSpec *file,
lldb::offset_t offset, lldb::offset_t length, ArchSpec arch,
- UUID uuid, std::vector<JSONSymbol> symbols);
+ UUID uuid, Type type, std::vector<JSONSymbol> symbols,
+ std::vector<JSONSection> sections);
};
bool fromJSON(const llvm::json::Value &value, ObjectFileJSON::Header &header,