[kernel] Use symbol table in stack traces
Now using the symbol table built by build_symbol_table.py in the kernel when printing stack traces.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#include "entry.h"
|
||||
|
||||
entry::entry(const std::string &in, const std::string &out, bool executable) :
|
||||
entry::entry(const std::string &in, const std::string &out,
|
||||
bool executable, bool symbols) :
|
||||
m_in(in),
|
||||
m_out(out),
|
||||
m_file(in, std::ios_base::binary),
|
||||
m_exec(executable)
|
||||
m_exec(executable),
|
||||
m_syms(symbols)
|
||||
{
|
||||
m_file.seekg(0, std::ios_base::end);
|
||||
m_size = m_file.tellg();
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
class entry
|
||||
{
|
||||
public:
|
||||
entry(const std::string &in, const std::string &out, bool executable = false);
|
||||
entry(
|
||||
const std::string &in,
|
||||
const std::string &out,
|
||||
bool executable = false,
|
||||
bool symbols = false);
|
||||
|
||||
inline const std::string & in() const { return m_in; }
|
||||
inline const std::string & out() const { return m_out; }
|
||||
inline const std::ifstream & file() const { return m_file; }
|
||||
|
||||
inline bool executable() const { return m_exec; }
|
||||
inline bool symbols() const { return m_syms; }
|
||||
inline size_t size() const { return m_size; }
|
||||
inline bool good() const { return m_file.good(); }
|
||||
|
||||
@@ -21,5 +26,6 @@ private:
|
||||
std::ifstream m_file;
|
||||
size_t m_size;
|
||||
bool m_exec;
|
||||
bool m_syms;
|
||||
};
|
||||
|
||||
|
||||
@@ -44,8 +44,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
auto exec = file->get_as<bool>("executable").value_or(false);
|
||||
auto syms = file->get_as<bool>("symbols").value_or(false);
|
||||
|
||||
entries.emplace_back(*source, *dest, exec);
|
||||
entries.emplace_back(*source, *dest, exec, syms);
|
||||
const entry &e = entries.back();
|
||||
|
||||
if (!e.good()) {
|
||||
@@ -96,6 +97,9 @@ int main(int argc, char **argv)
|
||||
if (e.executable())
|
||||
fheader.flags |= initrd::file_flags::executable;
|
||||
|
||||
if (e.symbols())
|
||||
fheader.flags |= initrd::file_flags::symbols;
|
||||
|
||||
out.write(
|
||||
reinterpret_cast<const char *>(&fheader),
|
||||
sizeof(fheader));
|
||||
|
||||
Reference in New Issue
Block a user