; --------------------------------------------------------------------------------------------; Copyright (c) Fantaisie Software. All rights reserved.; Dual licensed under the GPL and Fantaisie Software licenses.; See LICENSE and LICENSE-FANTAISIE in the project root for license information.; --------------------------------------------------------------------------------------------Global NextDataBreakPointID = 1Global RemoveDataBreakpoints = #False ; is #True when there are breakpoints to removeProcedure FindDataBreakpoint(*Debugger.DebuggerData, ID); Check the debugger data linked list*Point.DataBreakPoint = *Debugger\FirstDataBreakPointWhile *PointIf *Point\ID = IDProcedureReturn *PointElse*Point = *Point\NextEndIfWendProcedureReturn 0EndProcedure; removes only from the external debugger data, not from the exe!Procedure DeleteDataBreakPoint(*Debugger.DebuggerData, *Point.DataBreakPoint)If *Point\Next*Point\Next\Previous = *Point\PreviousEndIfIf *Point\Previous*Point\Previous\Next = *Point\NextEndIfIf *Point = *Debugger\FirstDataBreakPoint*Debugger\FirstDataBreakPoint = *Point\NextEndIfCompilerIf #CompilePPCDebug "FIXME: ClearStructure() broken on PPC"CompilerElseClearStructure(*Point, DataBreakPoint)CompilerEndIfFreeMemory(*Point)EndProcedureProcedure BreakPoint_AddItem(*Debugger.DebuggerData)Condition$ = GetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition])If Condition$ <> ""*Point.DataBreakPoint = AllocateMemory(SizeOf(DataBreakPoint))*Buffer = AllocateMemory(StringByteLength(Condition$)+SizeOf(Character) + SizeOf(Long))If *Point And *Buffer; (-2 = all); (-1 = main)ProcedureIndex = GetGadgetState(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure])-2If ProcedureIndex = -2*Point\ProcedureName$ = ""Else*Point\ProcedureName$ = GetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], ProcedureIndex+2)EndIf*Point\Condition$ = Condition$*Point\ID = NextDataBreakPointIDNextDataBreakPointID + 1; add to list*Point\Previous = 0*Point\Next = *Debugger\FirstDataBreakPointIf *Debugger\FirstDataBreakPoint*Debugger\FirstDataBreakPoint\Previous = *PointEndIf*Debugger\FirstDataBreakPoint = *PointCommand.CommandInfo\Command = #COMMAND_BreakPointCommand\Value1 = 4 ; add data breakpointCommand\Value2 = ProcedureIndexCommand\DataSize = StringByteLength(Condition$)+SizeOf(Character)+SizeOf(Long)PokeL(*Buffer, *Point\ID)PokeS(*Buffer+SizeOf(Long), Condition$)SendDebuggerCommandWithData(*Debugger, @Command, *Buffer)FreeMemory(*Buffer); We add the Condition to the list when we get the reply with ok or failureSetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition], "")EndIfEndIfEndProcedureProcedure DataBreakpointWindowEvents(*Debugger.DebuggerData, EventID)If EventID = #PB_Event_Menu ; for the Enter shortcutIf EventMenu() = #DEBUGGER_MENU_ReturnIf GetActiveGadget() = *Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition]BreakPoint_AddItem(*Debugger)EndIfEndIfElseIf EventID = #PB_Event_GadgetSelect EventGadget()Case *Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Add]BreakPoint_AddItem(*Debugger)Case *Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Remove]index = GetGadgetState(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List])If index <> -1Command.CommandInfo\Command = #COMMAND_BreakPointCommand\Value1 = 5 ; remove data breakpointCommand\Value2 = GetGadgetItemData(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index) ; this is the IDSendDebuggerCommand(*Debugger, @Command)RemoveGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index)EndIfCase *Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Clear]Command.CommandInfo\Command = #COMMAND_BreakPointCommand\Value1 = 6 ; clear data breakpointsSendDebuggerCommand(*Debugger, @Command)ClearGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List])EndSelectElseIf EventID = #PB_Event_SizeWindowWidth = WindowWidth (*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])Height = WindowHeight(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])GetRequiredSize(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Add], @ButtonWidth, @ButtonHeight)ButtonWidth = Max(ButtonWidth, 120)ButtonWidth = Max(ButtonWidth, GetRequiredWidth(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Remove]))ButtonWidth = Max(ButtonWidth, GetRequiredWidth(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Clear]))ComboHeight = GetRequiredHeight(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure])StringHeight = GetRequiredHeight(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition])TextWidth = Max(80, GetRequiredWidth(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Text1]))TextWidth = Max(TextWidth, GetRequiredWidth(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Text2]))TopOffset = Frame3DTopOffset(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Frame]) + 5BoxHeight = Max(ButtonHeight*3+20, TopOffset+ComboHeight+StringHeight+20)ButtonHeight = (BoxHeight-20) / 3ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], 10, 10, Width-20, Height-30-BoxHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Frame], 10, Height-10-BoxHeight, Width-30-ButtonWidth, BoxHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Text1], 25, Height-10-BoxHeight+TopOffset, TextWidth, ComboHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Text2], 25, Height-BoxHeight+TopOffset+ComboHeight, TextWidth, StringHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], 30+TextWidth, Height-10-BoxHeight+TopOffset, Width-65-ButtonWidth-TextWidth, ComboHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition], 30+TextWidth, Height-BoxHeight+TopOffset+ComboHeight, Width-65-ButtonWidth-TextWidth, StringHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Add], Width-10-ButtonWidth, Height-30-ButtonHeight*3, ButtonWidth, ButtonHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Remove], Width-10-ButtonWidth, Height-20-ButtonHeight*2, ButtonWidth, ButtonHeight)ResizeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Clear], Width-10-ButtonWidth, Height-10-ButtonHeight*1, ButtonWidth, ButtonHeight)ElseIf EventID = #PB_Event_CloseWindowIf DebuggerMemorizeWindows And IsWindowMinimized(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints]) = 0DataBreakpointWindowMaximize = IsWindowMaximized(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])If DataBreakpointWindowMaximize = 0DataBreakpointWindowX = WindowX(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])DataBreakpointWindowY = WindowY(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])DataBreakpointWindowWidth = WindowWidth (*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])DataBreakpointWindowHeight = WindowHeight(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints])EndIfEndIf; do not close window, only hide it;HideWindow(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints], 1)*Debugger\DataBreakpointsVisible = 0Debugger_CheckDestroy(*Debugger)EndIfEndProcedureProcedure UpdateDataBreakpointWindowState(*Debugger.DebuggerData)If *Debugger\ProgramState = -1DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Add], 1)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Remove], 1)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Clear], 1)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], 1)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition], 1)ElseDisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Add], 0)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Remove], 0)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Clear], 0)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], 0)DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Condition], 0); With the next update after the stop by the breakpoint, remove it;If *Debugger\ProgramState <> 9 And RemoveDataBreakpoints; step backwards so indexes don't change by removalsFor i = CountGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List])-1 To 0 Step -1*Point.DataBreakPoint = GetGadgetItemData(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], i)If *Point And *Point\ConditionTrueRemoveGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], i)DeleteDataBreakPoint(*Debugger, *Point)EndIfNext iRemoveDataBreakpoints = #FalseEndIfEndIfEndProcedureProcedure OpenDataBreakpointWindow(*Debugger.DebuggerData)If *Debugger\DataBreakpointsVisible = 0EnsureWindowOnDesktop(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints])HideWindow(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints], 0) ; show the window first.. otherwise sometimes the move/resize does not seem to work !?If DataBreakpointWindowWidth = 0 Or DataBreakpointWindowHeight = 0DataBreakpointWindowX = 75DataBreakpointWindowY = 75DataBreakpointWindowWidth = 700DataBreakpointWindowHeight = 300EndIfResizeWindow(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints], DataBreakpointWindowX, DataBreakpointWindowY, DataBreakpointWindowWidth, DataBreakpointWindowHeight)DataBreakpointWindowEvents(*Debugger, #PB_Event_SizeWindow); the filename is set after creation, so update it here...SetWindowTitle(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints], Language("Debugger","DataBreakpoints") + " - " + DebuggerTitle(*Debugger\FileName$))*Debugger\DataBreakpointsVisible = 1EndIfSetWindowForeground(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints])DataBreakpointWindowEvents(*Debugger, #PB_Event_SizeWindow)EndProcedure; this actually creates the window, but keeps it hidden;Procedure CreateDataBreakpointWindow(*Debugger.DebuggerData)Flags = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_Invisible|#PB_Window_MaximizeGadgetIf DataBreakpointWindowMaximizeFlags | #PB_Window_MaximizeEndIfWindow = OpenWindow(#PB_Any, 0, 0, 0, 0, Language("Debugger","DataBreakpoints") + " - " + GetFilePart(*Debugger\FileName$), Flags)If Window*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakpoints] = Window*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List] = ListIconGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger", "Procedure"), 100, #PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)AddGadgetColumn(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List], 1, Language("Debugger", "Condition"), 350)AddGadgetColumn(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List], 2, Language("Debugger", "ConditionStatus"), 250)*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Frame] = FrameGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","AddBreakPoint")+":")*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Text1] = TextGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","Procedure")+":", #PB_Text_Right)*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Text2] = TextGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","Condition")+":", #PB_Text_Right)*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Procedure] = ComboBoxGadget(#PB_Any, 0, 0, 0, 0)*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Condition] = StringGadget(#PB_Any, 0, 0, 0, 0, "")*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Add] = ButtonGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","Add"))*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Remove] = ButtonGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","Remove"))*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Clear] = ButtonGadget(#PB_Any, 0, 0, 0, 0, Language("Debugger","Clear"))*Debugger\DataBreakpointsVisible = 0CompilerIf #DEFAULT_CanWindowStayOnTopSetWindowStayOnTop(Window, DebuggerOnTop)CompilerEndIfAddKeyboardShortcut(Window, #PB_Shortcut_Return, #DEBUGGER_MENU_Return)Debugger_AddShortcuts(Window)EndIfEndProcedureProcedure UpdateDataBreakpointWindow(*Debugger.DebuggerData)SetWindowTitle(*Debugger\Windows[#DEBUGGER_WINDOW_DataBreakPoints], Language("Debugger","DataBreakpoints") + " - " + GetFilePart(*Debugger\FileName$))SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List], -1, Language("Debugger", "Procedure"), 0)SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List], -1, Language("Debugger", "Condition"), 1)SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_List], -1, Language("Debugger", "ConditionStatus"), 2)SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Frame], Language("Debugger", "AddBreakPoint")+":")SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Text1], Language("Debugger", "Procedure")+":")SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Text2], Language("Debugger", "Condition")+":")SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Add], Language("Debugger", "Add"))SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Remove], Language("Debugger", "Remove"))SetGadgetText(*Debugger\Gadgets[#DEBUGGER_GADGET_Breakpoint_Clear], Language("Debugger", "Clear"))DataBreakpointWindowEvents(*Debugger, #PB_Event_SizeWindow) ; update button sizesEndProcedure; ---------------------------------------------------------Procedure DataBreakpoint_DebuggerEvent(*Debugger.DebuggerData)Select *Debugger\Command\CommandCase #COMMAND_ProceduresClearGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure])AddGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], -1, Language("Debugger","AllProcedures"))AddGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], -1, Language("Debugger","NoProcedure"))*Pointer = *Debugger\ProceduresFor i = 1 To *Debugger\NbProceduresName$ = PeekAscii(*Pointer) + "()"*Pointer + MemoryAsciiLength(*Pointer) + 1ModName$ = PeekAscii(*Pointer)*Pointer + MemoryAsciiLength(*Pointer) + 1AddGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], -1, ModuleName(Name,ドル ModName$))Next iSetGadgetState(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_Procedure], 0)Case #COMMAND_DataBreakPoint*Point.DataBreakPoint = FindDataBreakpoint(*Debugger, *Debugger\Command\Value2) ; find our structureIf *Point; find the entry in the gadget (if any)index = -1last = CountGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List])-1For i = 0 To lastIf *Point = GetGadgetItemData(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], i)index = iBreakEndIfNext iSelect *Debugger\Command\Value1 ; statusCase 1 ; addedindex = CountGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List])AddGadgetItem(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, *Point\ProcedureName$+Chr(10)+*Point\Condition$)SetGadgetItemData(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, *Point)SetGadgetState(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index)Case 2 ; cannot addMessageRequester("PureBasic Debugger", Language("Debugger","BreakPointError")+#NewLine+*Point\Condition,ドル #FLAG_Warning)DeleteDataBreakPoint(*Debugger, *Point) ; delete from listCase 3 ; eval errorIf index <> -1SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, PeekS(*Debugger\CommandData, *Debugger\Command\DataSize, #PB_Ascii), 2)SetGadgetItemColor(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, #PB_Gadget_BackColor, 90ドルFFFF, -1)EndIfCase 4 ; falseIf index <> -1SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, "#False", 2)SetGadgetItemColor(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, #PB_Gadget_BackColor, -1, -1)EndIfCase 5 ; true; indicate that the breakpoint is true, but do not remove it; will be removed in UpdateWaichListWindowState() when the program continuesIf index <> -1SetGadgetItemText(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, "#True", 2)SetGadgetItemColor(*Debugger\Gadgets[#DEBUGGER_GADGET_BreakPoint_List], index, #PB_Gadget_BackColor, 90ドルFF90, -1)EndIf*Point\ConditionTrue = #TrueRemoveDataBreakpoints = #TrueEndSelectEndIfEndSelectEndProcedure
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。