More C++11ification.
This commit is contained in:
@@ -18,8 +18,7 @@ namespace runtime {
|
||||
|
||||
Function::Function(FunctionInfo* symbol_info)
|
||||
: address_(symbol_info->address()),
|
||||
symbol_info_(symbol_info),
|
||||
debug_info_(0) {}
|
||||
symbol_info_(symbol_info) {}
|
||||
|
||||
Function::~Function() = default;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef ALLOY_RUNTIME_FUNCTION_H_
|
||||
#define ALLOY_RUNTIME_FUNCTION_H_
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
@@ -31,8 +32,10 @@ class Function {
|
||||
uint64_t address() const { return address_; }
|
||||
FunctionInfo* symbol_info() const { return symbol_info_; }
|
||||
|
||||
DebugInfo* debug_info() const { return debug_info_; }
|
||||
void set_debug_info(DebugInfo* debug_info) { debug_info_ = debug_info; }
|
||||
DebugInfo* debug_info() const { return debug_info_.get(); }
|
||||
void set_debug_info(std::unique_ptr<DebugInfo> debug_info) {
|
||||
debug_info_ = std::move(debug_info);
|
||||
}
|
||||
|
||||
int AddBreakpoint(Breakpoint* breakpoint);
|
||||
int RemoveBreakpoint(Breakpoint* breakpoint);
|
||||
@@ -48,7 +51,7 @@ class Function {
|
||||
protected:
|
||||
uint64_t address_;
|
||||
FunctionInfo* symbol_info_;
|
||||
DebugInfo* debug_info_;
|
||||
std::unique_ptr<DebugInfo> debug_info_;
|
||||
|
||||
// TODO(benvanik): move elsewhere? DebugData?
|
||||
std::mutex lock_;
|
||||
|
||||
@@ -21,8 +21,8 @@ RawModule::~RawModule() {
|
||||
}
|
||||
}
|
||||
|
||||
int RawModule::LoadFile(uint64_t base_address, const char* path) {
|
||||
FILE* file = fopen(path, "rb");
|
||||
int RawModule::LoadFile(uint64_t base_address, const std::string& path) {
|
||||
FILE* file = fopen(path.c_str(), "rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
size_t file_length = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
@@ -42,7 +42,12 @@ int RawModule::LoadFile(uint64_t base_address, const char* path) {
|
||||
fclose(file);
|
||||
|
||||
// Setup debug info.
|
||||
name_ = std::string(xestrrchra(path, XE_PATH_SEPARATOR) + 1);
|
||||
auto last_slash = path.find_last_of(poly::path_separator);
|
||||
if (last_slash != std::string::npos) {
|
||||
name_ = path.substr(last_slash + 1);
|
||||
} else {
|
||||
name_ = path;
|
||||
}
|
||||
// TODO(benvanik): debug info
|
||||
|
||||
low_address_ = base_address;
|
||||
|
||||
@@ -22,7 +22,7 @@ class RawModule : public Module {
|
||||
RawModule(Runtime* runtime);
|
||||
~RawModule() override;
|
||||
|
||||
int LoadFile(uint64_t base_address, const char* path);
|
||||
int LoadFile(uint64_t base_address, const std::string& path);
|
||||
|
||||
const std::string& name() const override { return name_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user