# eric7.Debugger.DebugViewer

Module implementing a widget containing various debug related views.

The views avaliable are:

- selector showing all connected debugger backends with associated threads
- variables viewer for global variables for the selected debug client
- variables viewer for local variables for the selected debug client
- call stack viewer for the selected debug client
- call trace viewer
- viewer for breakpoints
- viewer for watch expressions
- viewer for exceptions
- viewer for a code disassembly for an exception

### Global Attributes

None

### Classes

DebugViewer | Class implementing a widget containing various debug related views.

### Functions

None

## DebugViewer

Class implementing a widget containing various debug related views.

The individual tabs contain the interpreter shell (optional), the filesystem browser (optional), the two variables viewers (global and local), a breakpoint viewer, a watch expression viewer and the exception logger. Additionally a list of all threads is shown.

### Signals

preferencesChanged()
  emitted to react on changed preferences
sourceFile(string, int)
  emitted to open a source file at a line

### Derived from

QWidget

### Class Attributes

DebuggerStateRole
StateIcon
StateMessage
ThreadIdRole

### Class Methods

None

### Methods

DebugViewer | Constructor
__addThreadList | Private method to add the list of threads to a debugger entry.
__callStackFrameSelected | Private slot to handle the selection of a call stack entry of the call stack viewer.
__clearStackComboBox | Private method to clear the given stack combo box.
__clientDebuggerId | Private slot to receive the ID of a newly connected debugger backend.
__clientException | Private method to handle an exception of the debugged program.
__clientExit | Private method to handle the debugged program terminating.
__clientLine | Private method to handle a change to the current line.
__clientSyntaxError | Private method to handle a syntax error in the debugged program.
__debuggerSelected | Private slot to handle the selection of a debugger backend in the debuggers list.
__frameSelected | Private slot to handle the selection of a new stack frame number.
__removeDebugger | Private method to remove a debugger given its ID.
__setCurrentDebugger | Private method to set the current debugger based on the given ID.
__setDebuggerIconAndState | Private method to set the icon for a specific debugger ID.
__setThreadIconAndState | Private method to set the icon for a specific thread name and debugger ID.
__showSource | Private slot to handle the source button press to show the selected file.
clearCallTrace | Public method to clear the recorded call trace.
currentWidget | Public method to get a reference to the current widget.
getSelectedDebuggerId | Public method to get the currently selected debugger ID.
getSelectedDebuggerState | Public method to get the currently selected debugger's state.
handleClientStack | Public slot to show the call stack of the program being debugged.
handleDebuggingStarted | Public slot to handle the start of a debugging session.
handlePreferencesChanged | Public slot to handle the preferencesChanged signal.
handleResetUI | Public method to reset the viewer.
initCallStackViewer | Public method to initialize the call stack viewer.
isCallTraceEnabled | Public method to get the state of the call trace function.
isOnlyDebugger | Public method to test, if only one debugger is connected.
refreshVariablesLists | Public slot to refresh the local and global variables lists.
setCallTraceToProjectMode | Public slot to set the call trace viewer to project mode.
setCurrentWidget | Public slot to set the current page based on the given widget.
setDebugger | Public method to set a reference to the Debug UI.
setGlobalsFilter | Public slot to set the global variable filter.
setLocalsFilter | Public slot to set the local variable filter.
setVariablesFilter | Public slot to set the local variables filter.
showVariable | Public method to show the variables in the respective window.
showVariables | Public method to show the variables in the respective window.
showVariablesTab | Public method to make a variables tab visible.

### Static Methods

None

#### DebugViewer (Constructor)

DebugViewer(debugServer, parent=None)

Constructor

debugServer (DebugServer)
  reference to the debug server object
parent (QWidget)
  parent widget

#### DebugViewer.__addThreadList

__addThreadList(currentID, threadList, debuggerId)

Private method to add the list of threads to a debugger entry.

currentID (int)
  id of the current thread
threadList (list of dict)
  list of dictionaries containing the thread data
debuggerId (str)
  ID of the debugger backend

#### DebugViewer.__callStackFrameSelected

__callStackFrameSelected(frameNo)

Private slot to handle the selection of a call stack entry of the call stack viewer.

frameNo (int)
  frame number (index) of the selected entry

#### DebugViewer.__clearStackComboBox

__clearStackComboBox(comboBox)

Private method to clear the given stack combo box.

comboBox (QComboBox)
  reference to the combo box to be cleared

#### DebugViewer.__clientDebuggerId

__clientDebuggerId(debuggerId)

Private slot to receive the ID of a newly connected debugger backend.

debuggerId (str)
  ID of a newly connected debugger backend

#### DebugViewer.__clientException

__clientException(exceptionType, exceptionMessage, stackTrace, debuggerId, threadName, )

Private method to handle an exception of the debugged program.

exceptionType (str)
  type of exception raised
exceptionMessage ((str)
  message given by the exception
stackTrace (list of str)
  list of stack entries
debuggerId (str)
  ID of the debugger backend
threadName (str)
  name of the thread signaling the event

#### DebugViewer.__clientExit

__clientExit(program, status, message, quiet, debuggerId)

Private method to handle the debugged program terminating.

program (str)
  name of the exited program
status (int)
  exit code of the debugged program
message (str)
  exit message of the debugged program
quiet (bool)
  flag indicating to suppress exit info display
debuggerId (str)
  ID of the debugger backend

#### DebugViewer.__clientLine

__clientLine(fn, line, debuggerId, threadName)

Private method to handle a change to the current line.

fn (str)
  filename
line (int)
  linenumber
debuggerId (str)
  ID of the debugger backend
threadName (str)
  name of the thread signaling the event

#### DebugViewer.__clientSyntaxError

__clientSyntaxError(message, filename, lineNo, characterNo, debuggerId, threadName, )

Private method to handle a syntax error in the debugged program.

message (str)
  message of the syntax error
filename (str)
  translated filename of the syntax error position
lineNo (int)
  line number of the syntax error position
characterNo (int)
  character number of the syntax error position
debuggerId (str)
  ID of the debugger backend
threadName (str)
  name of the thread signaling the event

#### DebugViewer.__debuggerSelected

__debuggerSelected(current, previous)

Private slot to handle the selection of a debugger backend in the debuggers list.

current (QTreeWidgetItem)
  reference to the new current item
previous (QTreeWidgetItem)
  reference to the previous current item

#### DebugViewer.__frameSelected

__frameSelected(frmnr)

Private slot to handle the selection of a new stack frame number.

frmnr (int)
  frame number (0 is the current frame)

#### DebugViewer.__removeDebugger

__removeDebugger(debuggerId)

Private method to remove a debugger given its ID.

debuggerId (str)
  ID of the debugger to be removed from the list

#### DebugViewer.__setCurrentDebugger

__setCurrentDebugger(debuggerId)

Private method to set the current debugger based on the given ID.

debuggerId (str)
  ID of the debugger to set as current debugger

#### DebugViewer.__setDebuggerIconAndState

__setDebuggerIconAndState(debuggerId, state)

Private method to set the icon for a specific debugger ID.

debuggerId (str)
  ID of the debugger backend (empty ID means the currently selected one)
state (str)
  state of the debugger (broken, exception, running)

#### DebugViewer.__setThreadIconAndState

__setThreadIconAndState(debuggerId, threadName, state)

Private method to set the icon for a specific thread name and debugger ID.

debuggerId (str)
  ID of the debugger backend (empty ID means the currently selected one)
threadName (str)
  name of the thread signaling the event
state (str)
  state of the debugger (broken, exception, running)

#### DebugViewer.__showSource

__showSource()

Private slot to handle the source button press to show the selected file.

#### DebugViewer.clearCallTrace

clearCallTrace()

Public method to clear the recorded call trace.

#### DebugViewer.currentWidget

currentWidget()

Public method to get a reference to the current widget.

Return:
  reference to the current widget

Return Type:
  QWidget

#### DebugViewer.getSelectedDebuggerId

getSelectedDebuggerId()

Public method to get the currently selected debugger ID.

Return:
  selected debugger ID

Return Type:
  str

#### DebugViewer.getSelectedDebuggerState

getSelectedDebuggerState()

Public method to get the currently selected debugger's state.

Return:
  selected debugger's state (broken, exception, running)

Return Type:
  str

#### DebugViewer.handleClientStack

handleClientStack(stack, debuggerId)

Public slot to show the call stack of the program being debugged.

stack (list of tuples of (str, str, str, str))
  list of tuples with call stack data (file name, line number, function name, formatted argument/values list)
debuggerId (str)
  ID of the debugger backend

#### DebugViewer.handleDebuggingStarted

handleDebuggingStarted()

Public slot to handle the start of a debugging session.

This slot sets the variables filter expressions.

#### DebugViewer.handlePreferencesChanged

handlePreferencesChanged()

Public slot to handle the preferencesChanged signal.

#### DebugViewer.handleResetUI

handleResetUI(fullReset)

Public method to reset the viewer.

fullReset (bool)
  flag indicating a full reset is required

#### DebugViewer.initCallStackViewer

initCallStackViewer(projectMode)

Public method to initialize the call stack viewer.

projectMode (bool)
  flag indicating to enable the project mode

#### DebugViewer.isCallTraceEnabled

isCallTraceEnabled()

Public method to get the state of the call trace function.

Return:
  flag indicating the state of the call trace function

Return Type:
  bool

#### DebugViewer.isOnlyDebugger

isOnlyDebugger()

Public method to test, if only one debugger is connected.

Return:
  flag indicating that only one debugger is connected

Return Type:
  bool

#### DebugViewer.refreshVariablesLists

refreshVariablesLists()

Public slot to refresh the local and global variables lists.

#### DebugViewer.setCallTraceToProjectMode

setCallTraceToProjectMode(enabled)

Public slot to set the call trace viewer to project mode.

In project mode the call trace info is shown with project relative path names.

enabled (bool)
  flag indicating to enable the project mode

#### DebugViewer.setCurrentWidget

setCurrentWidget(widget)

Public slot to set the current page based on the given widget.

widget (QWidget)
  reference to the widget

#### DebugViewer.setDebugger

setDebugger(debugUI)

Public method to set a reference to the Debug UI.

debugUI (DebugUI)
  reference to the DebugUI object

#### DebugViewer.setGlobalsFilter

setGlobalsFilter()

Public slot to set the global variable filter.

#### DebugViewer.setLocalsFilter

setLocalsFilter()

Public slot to set the local variable filter.

#### DebugViewer.setVariablesFilter

setVariablesFilter(globalsFilter, localsFilter)

Public slot to set the local variables filter.

globalsFilter (list of str)
  filter list for global variable types
localsFilter (list of str)
  filter list for local variable types

#### DebugViewer.showVariable

showVariable(vlist, showGlobals)

Public method to show the variables in the respective window.

vlist (list)
  list of variables to display
showGlobals (bool)
  flag indicating global/local state

#### DebugViewer.showVariables

showVariables(vlist, showGlobals)

Public method to show the variables in the respective window.

vlist (list)
  list of variables to display
showGlobals (bool)
  flag indicating global/local state

#### DebugViewer.showVariablesTab

showVariablesTab(showGlobals)

Public method to make a variables tab visible.

showGlobals (bool)
  flag indicating global/local state

Up