Skip to content

Commit

Permalink
update get breakpoint condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nblog committed Mar 24, 2023
1 parent fb311b0 commit 08e8bdf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
19 changes: 17 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,26 @@


for bp in dbgDebug.GetBreakpointList():
print( "bp: {} {:#x} {} {} {}".format(
descriptor = []
if (bp.breakCondition):
descriptor.append( "breakif({})".format(bp.breakCondition) )
if (bp.logText):
descriptor.append(
"logif({}, \"{}\")".format(bp.logCondition, bp.logText) \
if (bp.logCondition) else "log(\"{}\")".format(bp.logText)
)
if (bp.commandText):
descriptor.append(
"cmdif({}, \"{}\")".format(bp.commandCondition, bp.commandText) \
if (bp.commandCondition) else "cmd(\"{}\")".format(bp.commandText)
)

print( "bp: {} {:#x} {} {} {} {}".format(
( "soft" if (1 == bp.type) else ( "hard" if (2 == bp.type) else "蔡徐坤" ) ),
bp.addr, bp.mod,
( "once" if (bp.singleshoot) else ( "enable" if (bp.enabled) else "disable" ) ),
bp.hitCount ) )
bp.hitCount,
', '.join(descriptor) ) )

for book in dbgBookmark.GetBookmarkList():
print( "book: {}+{:#x}".format( book.mod, book.rva ) )
Expand Down
5 changes: 5 additions & 0 deletions x64dbgpy3/x64dbgpyt3.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ class BPXTYPE:
name:str
mod:str
hitCount:int
breakCondition:str
logCondition:str
commandCondition:str
logText:str
commandText:str

@staticmethod
def GetBreakpointList(bpxtype:DBGBREAKPOINTINFO.BPXTYPE=DBGBREAKPOINTINFO.BPXTYPE.bp_none):
Expand Down
23 changes: 17 additions & 6 deletions x64dbgpy3svr/x64dbghandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ namespace x64dbgSvrWrapper {
std::string name;
std::string mod;
uint32_t hitCount;
std::string breakCondition;
std::string logCondition;
std::string commandCondition;
std::string logText;
std::string commandText;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(BREAKPOINT_INFO_WRAPPER, \
type, addr, enabled, singleshoot, active, name, mod, hitCount)
type, addr, enabled, singleshoot, active, name, mod, hitCount,
breakCondition, logCondition, commandCondition, logText, commandText)

struct ARGUMENT_INFO_WRAPPER {
std::string mod;
Expand Down Expand Up @@ -688,27 +694,32 @@ namespace x64dbgSvrWrapper {
bps.bp[i].addr,
bps.bp[i].enabled, bps.bp[i].singleshoot, bps.bp[i].active,
bps.bp[i].name, bps.bp[i].mod,
bps.bp[i].hitCount
bps.bp[i].hitCount,
bps.bp[i].breakCondition,
bps.bp[i].logCondition,
bps.bp[i].commandCondition,
bps.bp[i].logText,
bps.bp[i].commandText,
};
}
BridgeFree(bps.bp); return breaks;
}

auto SetBreakpoint(ptr_t addr) {
return Script::Debug::SetBreakpoint(addr);
return Script::Debug::SetBreakpoint(addr);
}
auto DeleteBreakpoint(ptr_t addr) {
return Script::Debug::DeleteBreakpoint(addr);
}
auto DisableBreakpoint(ptr_t addr) {
return Script::Debug::DisableBreakpoint(addr);
return Script::Debug::DisableBreakpoint(addr);
}

auto SetHardwareBreakpoint(ptr_t addr, int32_t hard) {
return Script::Debug::SetHardwareBreakpoint(addr, Script::Debug::HardwareType(hard));
return Script::Debug::SetHardwareBreakpoint(addr, Script::Debug::HardwareType(hard));
}
auto DeleteHardwareBreakpoint(ptr_t addr) {
return Script::Debug::DeleteHardwareBreakpoint(addr);
return Script::Debug::DeleteHardwareBreakpoint(addr);
}
}
};

0 comments on commit 08e8bdf

Please sign in to comment.