Skip to content

Commit

Permalink
Implemented IDA native conditional breakpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
lab313ru committed Feb 27, 2024
1 parent 5d54dbc commit 352fd47
Show file tree
Hide file tree
Showing 16 changed files with 2,781 additions and 1,001 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.obj
*.json
*.tlog
*.pdb
*.iobj
Expand Down
27 changes: 14 additions & 13 deletions Gens/gens.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug8|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release8|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_68k|Win32'">
<LocalDebuggerCommandArguments>-nodebug 1</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug8|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release8|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_68k|Win32'">
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
161 changes: 82 additions & 79 deletions Gens/include/debugwindow.h
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
#ifndef DEBUG_WINDOW_H
#define DEBUG_WINDOW_H

#include <vector>
#include <string>
#include <map>

typedef unsigned int uint32;
typedef unsigned short ushort;

enum class bp_type
{
BP_PC = 1,
BP_READ,
BP_WRITE,
};

struct Breakpoint
{
bp_type type;

uint32 start;
uint32 end;

bool enabled;
bool is_forbid;

#ifdef DEBUG_68K
bool is_vdp;

Breakpoint(bp_type _type, uint32 _start, uint32 _end, bool _enabled, bool _is_vdp, bool _is_forbid) :
type(_type), start(_start), end(_end), enabled(_enabled), is_vdp(_is_vdp), is_forbid(_is_forbid) {};
#else
Breakpoint(bp_type _type, uint32 _start, uint32 _end, bool _enabled, bool _is_forbid) :
type(_type), start(_start), end(_end), enabled(_enabled), is_forbid(_is_forbid) {};
#endif
};

typedef std::vector<Breakpoint> bp_list;

#ifdef DEBUG_68K
#define MAX_ROM_SIZE 0x800000
#else
#define MAX_ROM_SIZE 0x10000 // including possible z80 code in 0x8000 - 0xFFFF
#endif

struct DebugWindow
{
DebugWindow();
std::vector<uint32> callstack;
std::map<uint32_t, uint32_t> changed;
bp_list Breakpoints;

bool DebugStop;

bool StepInto;
uint32 StepOver;

void Breakpoint(int pc);

bool BreakPC(int pc);
#ifdef DEBUG_68K
bool BreakRead(int pc, uint32 start, uint32 stop, bool is_vdp);
bool BreakWrite(int pc, uint32 start, uint32 stop, bool is_vdp);
#else
bool BreakRead(int pc, uint32 start, uint32 stop);
bool BreakWrite(int pc, uint32 start, uint32 stop);
#endif

virtual void DoStepOver();
virtual void TracePC(int pc);
virtual void TraceRead(uint32 start, uint32 stop);
virtual void TraceWrite(uint32 start, uint32 stop);
virtual ~DebugWindow();
};

extern void send_pause_event(int pc, std::map<uint32_t, uint32_t> changed);

#endif
#ifndef DEBUG_WINDOW_H
#define DEBUG_WINDOW_H

#include <vector>
#include <string>
#include <map>

typedef unsigned int uint32;
typedef unsigned short ushort;

enum class bp_type
{
BP_PC = 1,
BP_READ,
BP_WRITE,
};

struct Breakpoint
{
bp_type type;

uint32 start;
uint32 end;

bool enabled;

uint32 elang;
std::string condition;

#ifdef DEBUG_68K
bool is_vdp;

Breakpoint(bp_type _type, uint32 _start, uint32 _end, bool _enabled, bool _is_vdp, uint32 _elang, const std::string & _condition) :
type(_type), start(_start), end(_end), enabled(_enabled), is_vdp(_is_vdp), elang(_elang), condition(_condition) {};
#else
Breakpoint(bp_type _type, uint32 _start, uint32 _end, bool _enabled, uint32 _elang, const std::string& _condition) :
type(_type), start(_start), end(_end), enabled(_enabled), elang(_elang), condition(_condition) {};
#endif
};

typedef std::vector<Breakpoint> bp_list;

#ifdef DEBUG_68K
#define MAX_ROM_SIZE 0x800000
#else
#define MAX_ROM_SIZE 0x10000 // including possible z80 code in 0x8000 - 0xFFFF
#endif

struct DebugWindow
{
DebugWindow();
std::vector<uint32> callstack;
std::map<uint32_t, uint32_t> changed;
bp_list Breakpoints;

bool DebugStop;

bool StepInto;
uint32 StepOver;

void Breakpoint(int pc);

bool BreakPC(int pc);
#ifdef DEBUG_68K
bool BreakRead(int pc, uint32 start, uint32 stop, bool is_vdp);
bool BreakWrite(int pc, uint32 start, uint32 stop, bool is_vdp);
#else
bool BreakRead(int pc, uint32 start, uint32 stop);
bool BreakWrite(int pc, uint32 start, uint32 stop);
#endif

virtual void DoStepOver();
virtual void TracePC(int pc);
virtual void TraceRead(uint32 start, uint32 stop);
virtual void TraceWrite(uint32 start, uint32 stop);
virtual ~DebugWindow();
};

extern void send_pause_event(int pc, std::map<uint32_t, uint32_t> changed);
extern bool evaluate_condition(uint32 elang, const char* condition);

#endif
Loading

0 comments on commit 352fd47

Please sign in to comment.