Adding modules/functions to the debugger.
This commit is contained in:
@@ -18,7 +18,7 @@ namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XKernelModule::XKernelModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, path) {
|
||||
: XModule(kernel_state, ModuleType::kKernelModule, path) {
|
||||
emulator_ = kernel_state->emulator();
|
||||
memory_ = emulator_->memory();
|
||||
export_resolver_ = kernel_state->emulator()->export_resolver();
|
||||
|
||||
@@ -15,8 +15,12 @@
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XModule::XModule(KernelState* kernel_state, const std::string& path)
|
||||
: XObject(kernel_state, kTypeModule), path_(path) {
|
||||
XModule::XModule(KernelState* kernel_state, ModuleType module_type,
|
||||
const std::string& path)
|
||||
: XObject(kernel_state, kTypeModule),
|
||||
module_type_(module_type),
|
||||
path_(path),
|
||||
processor_module_(nullptr) {
|
||||
auto last_slash = path.find_last_of('/');
|
||||
if (last_slash == path.npos) {
|
||||
last_slash = path.find_last_of('\\');
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "xenia/cpu/module.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
@@ -20,13 +21,23 @@ namespace kernel {
|
||||
|
||||
class XModule : public XObject {
|
||||
public:
|
||||
XModule(KernelState* kernel_state, const std::string& path);
|
||||
enum class ModuleType {
|
||||
// Matches debugger Module type.
|
||||
kKernelModule = 0,
|
||||
kUserModule = 1,
|
||||
};
|
||||
|
||||
XModule(KernelState* kernel_state, ModuleType module_type,
|
||||
const std::string& path);
|
||||
virtual ~XModule();
|
||||
|
||||
ModuleType module_type() const { return module_type_; }
|
||||
const std::string& path() const { return path_; }
|
||||
const std::string& name() const { return name_; }
|
||||
bool Matches(const std::string& name) const;
|
||||
|
||||
xe::cpu::Module* processor_module() const { return processor_module_; }
|
||||
|
||||
virtual uint32_t GetProcAddressByOrdinal(uint16_t ordinal) = 0;
|
||||
virtual uint32_t GetProcAddressByName(const char* name) = 0;
|
||||
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
|
||||
@@ -35,8 +46,11 @@ class XModule : public XObject {
|
||||
protected:
|
||||
void OnLoad();
|
||||
|
||||
ModuleType module_type_;
|
||||
std::string name_;
|
||||
std::string path_;
|
||||
|
||||
xe::cpu::Module* processor_module_;
|
||||
};
|
||||
|
||||
} // namespace kernel
|
||||
|
||||
@@ -21,7 +21,9 @@ namespace kernel {
|
||||
using namespace xe::cpu;
|
||||
|
||||
XUserModule::XUserModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, path), xex_(nullptr), execution_info_ptr_(0) {}
|
||||
: XModule(kernel_state, ModuleType::kUserModule, path),
|
||||
xex_(nullptr),
|
||||
execution_info_ptr_(0) {}
|
||||
|
||||
XUserModule::~XUserModule() {
|
||||
kernel_state()->memory()->SystemHeapFree(execution_info_ptr_);
|
||||
@@ -119,6 +121,7 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
if (!xex_module->Load(name_, path_, xex_)) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
processor_module_ = xex_module.get();
|
||||
if (!processor->AddModule(std::move(xex_module))) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user