Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables----------------------------------------------------------------------------------------
- local DNOPTable = {}
- --Functions----------------------------------------------------------------------------------------
- function toggleDNOP(memoryViewForm)
- local minAddr = math.min(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
- local maxAddr = math.max(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
- if DNOPTable[minAddr] ~= nil then
- deleteDNOP(memoryViewForm)
- return
- end
- debug_setBreakpoint(minAddr)
- if (minAddr == maxAddr) then maxAddr = minAddr+getInstructionSize(minAddr) end
- DNOPTable[minAddr] = maxAddr
- end
- function debugger_onBreakpoint()
- local bitMode = targetIs64Bit()
- for i,j in pairs(DNOPTable) do
- if bitMode then
- if i == RIP then
- RIP = j
- end
- else
- if i == EIP then
- EIP = j
- debug_continueFromBreakpoint(co_run)
- return 1
- end
- end
- end
- end
- function deleteDNOP(memoryViewForm)
- local minAddr = math.min(memoryViewForm.DisassemblerView.SelectedAddress,memoryViewForm.DisassemblerView.SelectedAddress2)
- if DNOPTable[minAddr] ~= nil then
- debug_removeBreakpoint(minAddr)
- DNOPTable[minAddr] = nil
- debug_continueFromBreakpoint(co_run)
- end
- end
- function AddItemMenuInMemoryViewForm(memoryViewForm, nameItemMenu, shortcut, functionItemClick)
- local dv = memoryViewForm.DisassemblerView
- local popupmenu = dv.PopupMenu
- local mi = createMenuItem(popupmenu)
- mi.Caption = nameItemMenu
- mi.onClick =
- function ()
- functionItemClick(memoryViewForm)
- end
- mi.Shortcut = shortcut
- popupmenu.Items.add(mi)
- end
- function AddItemMenuSeparatorInMemoryViewForm(memoryViewForm)
- local dv = memoryViewForm.DisassemblerView
- local popupmenu = dv.PopupMenu
- local mi = createMenuItem(popupmenu)
- mi.Caption = '-'
- popupmenu.Items.add(mi)
- end
- function addPopUpMenuEntry(memoryViewForm)
- if memoryViewForm.ClassName~="TMemoryBrowser" then
- return
- else
- local timer=createTimer()
- timer.Interval=100
- timer.OnTimer = function (t)
- t.destroy()
- AddItemMenuSeparatorInMemoryViewForm(memoryViewForm)
- AddItemMenuInMemoryViewForm(getMemoryViewForm(), 'Set/Unset DNOP Breakpoint', nil, toggleDNOP)
- end
- end
- end
- --Main---------------------------------------------------------------------------------------------
- registerFormAddNotification(addPopUpMenuEntry)
- AddItemMenuSeparatorInMemoryViewForm(getMemoryViewForm())
- AddItemMenuInMemoryViewForm(getMemoryViewForm(), 'Set/Unset DNOP Breakpoint', nil, toggleDNOP)
- --Events-------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement