xdb progress; skeleton trace loading.

This commit is contained in:
Ben Vanik 2014-08-14 23:53:10 -07:00
parent bae26f7dfc
commit 21225b5917
22 changed files with 1236 additions and 18 deletions

16
src/xdb/debug_target.cc Normal file
View File

@ -0,0 +1,16 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/debug_target.h>
namespace xdb {
//
} // namespace xdb

23
src/xdb/debug_target.h Normal file
View File

@ -0,0 +1,23 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_DEBUG_TARGET_H_
#define XDB_DEBUG_TARGET_H_
namespace xdb {
class DebugTarget {
public:
protected:
DebugTarget() = default;
};
} // namespace xdb
#endif // XDB_DEBUG_TARGET_H_

View File

@ -0,0 +1,38 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/postmortem_debug_target.h>
namespace xdb {
bool PostmortemDebugTarget::LoadTrace(const std::wstring& path) {
// TODO(benvanik): memory map trace.
return true;
}
bool PostmortemDebugTarget::LoadContent(const std::wstring& path) {
// If no path is provided attempt to infer from the trace.
if (path.empty()) {
// TODO(benvanik): find process info block and read source path.
}
// TODO(benvanik): initialize filesystem and load iso/stfs/etc to get at xex.
return true;
}
bool PostmortemDebugTarget::Prepare() {
std::atomic<bool> cancelled(false);
return Prepare(cancelled);
}
bool PostmortemDebugTarget::Prepare(std::atomic<bool>& cancelled) {
// TODO(benvanik): scan file, build indicies, etc.
return true;
}
} // namespace xdb

View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_POSTMORTEM_DEBUG_TARGET_H_
#define XDB_POSTMORTEM_DEBUG_TARGET_H_
#include <atomic>
#include <string>
#include <xdb/debug_target.h>
namespace xdb {
class PostmortemDebugTarget : public DebugTarget {
public:
PostmortemDebugTarget() = default;
bool LoadTrace(const std::wstring& path);
bool LoadContent(const std::wstring& path = L"");
bool Prepare();
bool Prepare(std::atomic<bool>& cancelled);
};
} // namespace xdb
#endif // XDB_POSTMORTEM_DEBUG_TARGET_H_

View File

@ -1,6 +1,10 @@
# Copyright 2014 Ben Vanik. All Rights Reserved.
{
'sources': [
'debug_target.cc',
'debug_target.h',
'postmortem_debug_target.cc',
'postmortem_debug_target.h',
'protocol.h',
'xdb.cc',
'xdb.h',
@ -9,6 +13,7 @@
],
'includes': [
'sym/sources.gypi',
'ui/sources.gypi',
],
}

View File

@ -0,0 +1,20 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/sym/map_symbol_database.h>
namespace xdb {
namespace sym {
Symbol* MapSymbolDatabase::Lookup(uint32_t address) {
return nullptr;
}
} // namespace sym
} // namespace xdb

View File

@ -0,0 +1,26 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_SYM_MAP_SYMBOL_DATABASE_H_
#define XDB_SYM_MAP_SYMBOL_DATABASE_H_
#include <xdb/sym/symbol_database.h>
namespace xdb {
namespace sym {
class MapSymbolDatabase : public SymbolDatabase {
public:
Symbol* Lookup(uint32_t address) override;
};
} // namespace sym
} // namespace xdb
#endif // XDB_SYM_MAP_SYMBOL_DATABASE_H_

14
src/xdb/sym/sources.gypi Normal file
View File

@ -0,0 +1,14 @@
# Copyright 2014 Ben Vanik. All Rights Reserved.
{
'sources': [
'map_symbol_database.cc',
'map_symbol_database.h',
'symbol_database.cc',
'symbol_database.h',
'symbol_provider.cc',
'symbol_provider.h',
],
'includes': [
],
}

View File

@ -0,0 +1,18 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/sym/symbol_database.h>
namespace xdb {
namespace sym {
//
} // namespace sym
} // namespace xdb

View File

@ -0,0 +1,50 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_SYM_SYMBOL_DATABASE_H_
#define XDB_SYM_SYMBOL_DATABASE_H_
#include <cstdint>
#include <string>
namespace xdb {
namespace sym {
class ObjectFile {
public:
std::string library;
std::string name;
};
enum class SymbolType {
FUNCTION,
VARIABLE,
};
class Symbol {
public:
uint32_t address;
ObjectFile* object_file;
std::string name;
SymbolType type;
bool is_inlined;
};
class SymbolDatabase {
public:
virtual Symbol* Lookup(uint32_t address) = 0;
protected:
SymbolDatabase() = default;
};
} // namespace sym
} // namespace xdb
#endif // XDB_SYM_SYMBOL_DATABASE_H_

View File

@ -0,0 +1,25 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/sym/symbol_provider.h>
namespace xdb {
namespace sym {
void SymbolProvider::AddSearchPath(const std::string& path) {
//
}
std::unique_ptr<SymbolDatabase> SymbolProvider::LoadDatabase(
const std::string& module_path) {
return nullptr;
}
} // namespace sym
} // namespace xdb

View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_SYM_SYMBOL_PROVIDER_H_
#define XDB_SYM_SYMBOL_PROVIDER_H_
#include <memory>
#include <string>
#include <xdb/sym/symbol_database.h>
namespace xdb {
namespace sym {
class SymbolProvider {
public:
SymbolProvider() = default;
void AddSearchPath(const std::string& path);
std::unique_ptr<SymbolDatabase> LoadDatabase(const std::string& module_path);
};
} // namespace sym
} // namespace xdb
#endif // XDB_SYM_SYMBOL_PROVIDER_H_

View File

@ -12,7 +12,8 @@
namespace xdb {
namespace ui {
MainFrame::MainFrame() : MainFrameBase(nullptr) {}
MainFrame::MainFrame(std::unique_ptr<DebugTarget> debug_target)
: MainFrameBase(nullptr), debug_target_(std::move(debug_target)) {}
} // namespace ui
} // namespace xdb

View File

@ -10,8 +10,9 @@
#ifndef XDB_UI_MAIN_FRAME_H_
#define XDB_UI_MAIN_FRAME_H_
#include <cstdint>
#include <memory>
#include <xdb/debug_target.h>
#include <xdb/ui/xdb_ui.h>
namespace xdb {
@ -19,9 +20,13 @@ namespace ui {
class MainFrame : public MainFrameBase {
public:
MainFrame();
MainFrame(std::unique_ptr<DebugTarget> debug_target);
protected:
//
private:
std::unique_ptr<DebugTarget> debug_target_;
};
} // namespace ui

View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XDB_UI_OPEN_POSTMORTEM_TRACE_DIALOG_H_
#define XDB_UI_OPEN_POSTMORTEM_TRACE_DIALOG_H_
#include <xdb/ui/xdb_ui.h>
namespace xdb {
namespace ui {
class OpenPostmortemTraceDialog : public OpenPostmortemTraceDialogBase {
public:
OpenPostmortemTraceDialog() : OpenPostmortemTraceDialogBase(nullptr) {}
const std::wstring trace_file_path() const {
return trace_file_picker_->GetFileName().GetFullPath().ToStdWstring();
}
const std::wstring content_file_path() const {
return content_file_picker_->GetFileName().GetFullPath().ToStdWstring();
}
};
} // namespace ui
} // namespace xdb
#endif // XDB_UI_OPEN_POSTMORTEM_TRACE_DIALOG_H_

View File

@ -3,6 +3,7 @@
'sources': [
'main_frame.cc',
'main_frame.h',
'open_postmortem_trace_dialog.h',
'xdb_ui.cpp',
'xdb_ui.h',
],

View File

@ -11,7 +11,7 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file"></property>
<property name="file">xdb_ui</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">0</property>
@ -46,7 +46,7 @@
<property name="pos"></property>
<property name="size">1024,768</property>
<property name="style">wxDEFAULT_FRAME_STYLE</property>
<property name="subclass"></property>
<property name="subclass">; </property>
<property name="title">xenia debugger</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -135,7 +135,7 @@
<event name="OnUpdateUI"></event>
<object class="wxMenu" expanded="1">
<property name="label">File</property>
<property name="name">file</property>
<property name="name">file_menu_</property>
<property name="permission">protected</property>
</object>
</object>
@ -536,5 +536,638 @@
</object>
</object>
</object>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style"></property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">OpenPostmortemTraceDialogBase</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass"></property>
<property name="title">Open Postmortem Trace</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">root_panel_outer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">root_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">1</property>
<property name="flexible_direction">wxVERTICAL</property>
<property name="growablecols">0</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">root_sizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use --trace_file= to specify the output file path when running xenia-run.</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">info_label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">content_sizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Trace File:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">trace_file_label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER|wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFilePickerCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="message">Select a .trace file</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">trace_file_picker_</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxFLP_DEFAULT_STYLE|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="wildcard">*.trace</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnFileChanged"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Content Path:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">content_file_label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">none</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER|wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFilePickerCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="message">Select the source content path</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">content_file_picker_</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="wildcard">*.xex;*.iso;*.*</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnFileChanged"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">dialog_buttons_</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelButtonClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOKButtonClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -17,8 +17,8 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
m_mgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);
menu_bar_ = new wxMenuBar( 0 );
file = new wxMenu();
menu_bar_->Append( file, wxT("File") );
file_menu_ = new wxMenu();
menu_bar_->Append( file_menu_, wxT("File") );
this->SetMenuBar( menu_bar_ );
@ -47,3 +47,83 @@ MainFrameBase::~MainFrameBase()
m_mgr.UnInit();
}
OpenPostmortemTraceDialogBase::OpenPostmortemTraceDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* root_panel_outer;
root_panel_outer = new wxBoxSizer( wxVERTICAL );
wxPanel* root_panel;
root_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* root_sizer;
root_sizer = new wxFlexGridSizer( 0, 1, 0, 0 );
root_sizer->AddGrowableCol( 0 );
root_sizer->SetFlexibleDirection( wxVERTICAL );
root_sizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxStaticText* info_label;
info_label = new wxStaticText( root_panel, wxID_ANY, wxT("Use --trace_file= to specify the output file path when running xenia-run."), wxDefaultPosition, wxDefaultSize, 0 );
info_label->Wrap( -1 );
root_sizer->Add( info_label, 0, wxALL, 5 );
wxFlexGridSizer* content_sizer;
content_sizer = new wxFlexGridSizer( 0, 2, 0, 0 );
content_sizer->AddGrowableCol( 1 );
content_sizer->SetFlexibleDirection( wxBOTH );
content_sizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxStaticText* trace_file_label;
trace_file_label = new wxStaticText( root_panel, wxID_ANY, wxT("Trace File:"), wxDefaultPosition, wxDefaultSize, 0 );
trace_file_label->Wrap( -1 );
content_sizer->Add( trace_file_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
trace_file_picker_ = new wxFilePickerCtrl( root_panel, wxID_ANY, wxEmptyString, wxT("Select a .trace file"), wxT("*.trace"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL );
content_sizer->Add( trace_file_picker_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 5 );
wxStaticText* content_file_label;
content_file_label = new wxStaticText( root_panel, wxID_ANY, wxT("Content Path:"), wxDefaultPosition, wxDefaultSize, 0 );
content_file_label->Wrap( -1 );
content_sizer->Add( content_file_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
content_file_picker_ = new wxFilePickerCtrl( root_panel, wxID_ANY, wxEmptyString, wxT("Select the source content path"), wxT("*.xex;*.iso;*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL );
content_sizer->Add( content_file_picker_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 5 );
root_sizer->Add( content_sizer, 0, wxEXPAND, 5 );
dialog_buttons_ = new wxStdDialogButtonSizer();
dialog_buttons_OK = new wxButton( root_panel, wxID_OK );
dialog_buttons_->AddButton( dialog_buttons_OK );
dialog_buttons_Cancel = new wxButton( root_panel, wxID_CANCEL );
dialog_buttons_->AddButton( dialog_buttons_Cancel );
dialog_buttons_->Realize();
root_sizer->Add( dialog_buttons_, 1, wxEXPAND, 0 );
root_panel->SetSizer( root_sizer );
root_panel->Layout();
root_sizer->Fit( root_panel );
root_panel_outer->Add( root_panel, 1, wxEXPAND | wxALL, 10 );
this->SetSizer( root_panel_outer );
this->Layout();
root_panel_outer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
dialog_buttons_Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( OpenPostmortemTraceDialogBase::OnCancelButtonClick ), NULL, this );
dialog_buttons_OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( OpenPostmortemTraceDialogBase::OnOKButtonClick ), NULL, this );
}
OpenPostmortemTraceDialogBase::~OpenPostmortemTraceDialogBase()
{
// Disconnect Events
dialog_buttons_Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( OpenPostmortemTraceDialogBase::OnCancelButtonClick ), NULL, this );
dialog_buttons_OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( OpenPostmortemTraceDialogBase::OnOKButtonClick ), NULL, this );
}

View File

@ -25,6 +25,11 @@
#include <wx/panel.h>
#include <wx/aui/auibook.h>
#include <wx/frame.h>
#include <wx/stattext.h>
#include <wx/filepicker.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -41,7 +46,7 @@ namespace xdb
protected:
wxMenuBar* menu_bar_;
wxMenu* file;
wxMenu* file_menu_;
wxAuiToolBar* tool_bar_;
wxAuiToolBarItem* tool_test_;
wxStatusBar* status_bar_;
@ -58,6 +63,32 @@ namespace xdb
};
///////////////////////////////////////////////////////////////////////////////
/// Class OpenPostmortemTraceDialogBase
///////////////////////////////////////////////////////////////////////////////
class OpenPostmortemTraceDialogBase : public wxDialog
{
private:
protected:
wxFilePickerCtrl* trace_file_picker_;
wxFilePickerCtrl* content_file_picker_;
wxStdDialogButtonSizer* dialog_buttons_;
wxButton* dialog_buttons_OK;
wxButton* dialog_buttons_Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
OpenPostmortemTraceDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Open Postmortem Trace"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
~OpenPostmortemTraceDialogBase();
};
} // namespace ui
} // namespace xdb

View File

@ -9,21 +9,123 @@
#include <xdb/xdb_app.h>
#include <atomic>
#include <codecvt>
#include <thread>
#include <poly/assert.h>
#include <xdb/postmortem_debug_target.h>
#include <xdb/ui/main_frame.h>
#include <xdb/ui/open_postmortem_trace_dialog.h>
#include <third_party/wxWidgets/include/wx/progdlg.h>
namespace xdb {
IMPLEMENT_APP(XdbApp);
bool XdbApp::OnInit() {
main_frame_.reset(new ui::MainFrame());
main_frame_->Show();
return true;
}
bool XdbApp::OnInit() { return true; }
int XdbApp::OnExit() {
// Top level windows are deleted by wx automatically.
main_frame_.release();
return 0;
}
void XdbApp::OpenEmpty() {
while (true) {
ui::OpenPostmortemTraceDialog dialog;
if (dialog.ShowModal() == wxID_CANCEL) {
Exit();
return;
}
if (OpenTraceFile(dialog.trace_file_path(), dialog.content_file_path())) {
break;
}
}
}
bool XdbApp::OpenTraceFile(const std::string& trace_file_path,
const std::string& content_file_path) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return OpenTraceFile(converter.from_bytes(trace_file_path),
converter.from_bytes(content_file_path));
}
bool XdbApp::OpenTraceFile(const std::wstring& trace_file_path,
const std::wstring& content_file_path) {
std::unique_ptr<PostmortemDebugTarget> target(new PostmortemDebugTarget());
if (!target->LoadTrace(trace_file_path)) {
HandleOpenError("Unable to load trace file.");
return false;
}
if (!target->LoadContent(content_file_path)) {
HandleOpenError("Unable to load source game content module.");
return false;
}
wxProgressDialog progress_dialog(
"Preparing trace...", "This may take some time.", 100, nullptr,
wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_CAN_ABORT |
wxPD_ELAPSED_TIME | wxPD_ELAPSED_TIME);
progress_dialog.Show();
enum class PrepareStatus {
PROCESSING,
SUCCEEDED,
FAILED,
};
std::atomic<PrepareStatus> status(PrepareStatus::PROCESSING);
std::atomic<bool> cancelled;
std::thread preparation_thread([&target, &cancelled, &status]() {
status = target->Prepare(cancelled) ? PrepareStatus::SUCCEEDED
: PrepareStatus::FAILED;
});
do {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
} while (status == PrepareStatus::PROCESSING && progress_dialog.Pulse());
cancelled = progress_dialog.WasCancelled();
preparation_thread.join();
progress_dialog.Hide();
if (cancelled) {
return false;
}
if (status == PrepareStatus::FAILED) {
HandleOpenError("Invalid trace file; unable to process.");
return false;
}
return OpenDebugTarget(std::move(target));
}
bool XdbApp::OpenDebugTarget(std::unique_ptr<DebugTarget> debug_target) {
auto main_frame = new ui::MainFrame(std::move(debug_target));
main_frames_.push_back(main_frame);
main_frame->Connect(wxEVT_DESTROY, wxEventHandler(XdbApp::OnMainFrameDestroy),
nullptr, this);
main_frame->Show();
main_frame->SetFocus();
return true;
}
void XdbApp::HandleOpenError(const std::string& message) {
wxMessageDialog dialog(nullptr, message, "Error",
wxOK | wxOK_DEFAULT | wxICON_ERROR);
dialog.ShowModal();
}
void XdbApp::OnMainFrameDestroy(wxEvent& event) {
for (auto it = main_frames_.begin(); it != main_frames_.end(); ++it) {
if (*it == event.GetEventObject()) {
main_frames_.erase(it);
return;
}
}
assert_always();
}
} // namespace xdb

View File

@ -11,10 +11,18 @@
#define XDB_XDB_APP_H_
#include <memory>
#include <string>
#include <vector>
#include <xdb/ui/main_frame.h>
#include <xdb/debug_target.h>
#include <third_party/wxWidgets/include/wx/wx.h>
namespace xdb {
namespace ui {
class MainFrame;
} // namespace ui
} // namespace xdb
namespace xdb {
class XdbApp : public wxApp {
@ -22,8 +30,19 @@ class XdbApp : public wxApp {
bool OnInit() override;
int OnExit() override;
void OpenEmpty();
bool OpenTraceFile(const std::string& trace_file_path,
const std::string& content_file_path = "");
bool OpenTraceFile(const std::wstring& trace_file_path,
const std::wstring& content_file_path = L"");
bool OpenDebugTarget(std::unique_ptr<DebugTarget> debug_target);
private:
std::unique_ptr<ui::MainFrame> main_frame_;
void HandleOpenError(const std::string& message);
void OnMainFrameDestroy(wxEvent& event);
std::vector<ui::MainFrame*> main_frames_;
};
} // namespace xdb

View File

@ -16,6 +16,10 @@
#include <third_party/wxWidgets/include/wx/wx.h>
#include <xdb/xdb_app.h>
DEFINE_string(trace_file, "", "Trace file to load on startup.");
DEFINE_string(content_file, "",
"ISO/STFS/XEX file the specified trace_file should reference.");
namespace xdb {
int main(int argc, xechar_t** argv) {
@ -44,6 +48,14 @@ int main(int argc, xechar_t** argv) {
XEFATAL("Failed to init app");
return 1;
}
if (!FLAGS_trace_file.empty()) {
// Trace file specified on command line.
app->OpenTraceFile(FLAGS_trace_file, FLAGS_content_file);
} else {
app->OpenEmpty();
}
app->OnRun();
int result_code = app->OnExit();
wxEntryCleanup();