Track export data on Guest Functions

This commit is contained in:
Dr. Chat 2015-11-28 13:55:14 -06:00 committed by Ben Vanik
parent 42c657c40a
commit db8eb83057
3 changed files with 10 additions and 3 deletions

View File

@ -60,9 +60,10 @@ GuestFunction::GuestFunction(Module* module, uint32_t address)
GuestFunction::~GuestFunction() = default; GuestFunction::~GuestFunction() = default;
void GuestFunction::SetupExtern(ExternHandler handler) { void GuestFunction::SetupExtern(ExternHandler handler, Export* export_data) {
behavior_ = Behavior::kExtern; behavior_ = Behavior::kExtern;
extern_handler_ = handler; extern_handler_ = handler;
export_data_ = export_data;
} }
const SourceMapEntry* GuestFunction::LookupGuestAddress( const SourceMapEntry* GuestFunction::LookupGuestAddress(

View File

@ -20,6 +20,10 @@
#include "xenia/debug/function_trace_data.h" #include "xenia/debug/function_trace_data.h"
namespace xe { namespace xe {
namespace cpu {
class Export;
} // namespace cpu
namespace cpu { namespace cpu {
struct SourceMapEntry { struct SourceMapEntry {
@ -115,7 +119,8 @@ class GuestFunction : public Function {
std::vector<SourceMapEntry>& source_map() { return source_map_; } std::vector<SourceMapEntry>& source_map() { return source_map_; }
ExternHandler extern_handler() const { return extern_handler_; } ExternHandler extern_handler() const { return extern_handler_; }
void SetupExtern(ExternHandler handler); Export* export_data() const { return export_data_; }
void SetupExtern(ExternHandler handler, Export* export_data = nullptr);
const SourceMapEntry* LookupGuestAddress(uint32_t guest_address) const; const SourceMapEntry* LookupGuestAddress(uint32_t guest_address) const;
const SourceMapEntry* LookupHIROffset(uint32_t offset) const; const SourceMapEntry* LookupHIROffset(uint32_t offset) const;
@ -135,6 +140,7 @@ class GuestFunction : public Function {
debug::FunctionTraceData trace_data_; debug::FunctionTraceData trace_data_;
std::vector<SourceMapEntry> source_map_; std::vector<SourceMapEntry> source_map_;
ExternHandler extern_handler_ = nullptr; ExternHandler extern_handler_ = nullptr;
Export* export_data_ = nullptr;
}; };
} // namespace cpu } // namespace cpu

View File

@ -475,7 +475,7 @@ bool XexModule::SetupLibraryImports(const char* name,
XELOGW("WARNING: Imported kernel function %s is unimplemented!", XELOGW("WARNING: Imported kernel function %s is unimplemented!",
import_name.GetString()); import_name.GetString());
} }
static_cast<GuestFunction*>(function)->SetupExtern(handler); static_cast<GuestFunction*>(function)->SetupExtern(handler, kernel_export);
} }
function->set_status(Symbol::Status::kDeclared); function->set_status(Symbol::Status::kDeclared);
} else { } else {