Escolar Documentos
Profissional Documentos
Cultura Documentos
Debuggers allow
Controlled stepping through program Runtime examination of variables Interactive analysis of program No recompile needed each time a possible bug ruled out.
A breakpoint is a pseudo instruction that the user insert at any place into the program at debug time. execution is controlled by the debugger and the debugger will interpret the breakpoints. When execution crosses a breakpoint, the debugger will pause program execution The user can then
inspect variables set or clear breakpoints
continue execution
Trace back
Show the path by which the current statement was reached. Shows which statements have modified a given variable or parameter.
Debugging
It is the process of isolating & correcting the causes of the known errors in a program Debug monitors provides the following facilities for debugging
1. Setting break points in the program 2. Initiating a debug conversation when control reaches a break point. 3. Displaying values of variables. 4. Assigning new values to variables. 5. Testing user defined programs.
1.
Steps in Debugging
2. 3. 4. 5.
User activates the debug monitor & indicates the name of program to be debugged. Debug monitor opens:
1. 2. 1. 2. 1. 2. Compiled code Debug information file of the program List of break points Action to be performed at break points Statement number Debug action
User specifies his debug requirements, with Debug monitor builds a table containing:
Steps 4 & 5 are repeated until the end of the debug session.
1.
2.
Program executes up to a break point, and then a software interrupt is generated & control is given to the debug monitor, then consults debug table and performs the debug actions specified for the break point. Control returns to the program
Postmortem analysis
When a program that is run in a debugger crashes,
debugger is used to understand the reason for the crash This analysis is done after the fact ("post mortem", "after death")
It is based on analyzing
which calls in the program produced the call nesting that was active at the time of the crash the variables in these active calls
Advantage:
Postmortem analysis is simple and possibly quick One cannot analyze how the program arrived at the program state that produced the crash
Disadvantage:
Program understanding
A debugger helps understanding code one does know well
Choose simple program inputs first Single-step through the program Step into methods of interest; step over the rest Inspect variables as required Use a breakpoint to finish loops you have understood
Advantage
No thinking errors Computer keeps track of variable values for you
Limitations:
Difficult to apply for non-sequential programs
Hypothesis testing
A debugger helps gathering information about specific aspects of a program without modifying the program
No need to insert analysis code, recompile, redeploy Program state at a certain point during execution Validating specific expected events
their occurrence their order their frequency
Kinds of information:
Editors
A text editor is a type of program used for editing plain text files .Often provided with operating systems.
Features of text editors String searching algorithm Cut, copy, and paste Text formatting Undo and redo Data transformation Filtering Syntax highlighting
Types of Editors
Line editors Stream editors Screen editors Word processors Structure editors
Line Editors
Scope of line editors is limited to a line of text The line is designated positionally, by specifying the serial number in the text. Edit characters like end of line is maintained internally. Advantage
Simplicity.
Line Editor: Line editor is one of the simplest type of editor which uses a buffer to store information: It operates in command mode. User give the command to the editor for any operation. Editor will respond this command. Buffer is in the main memory. That is set aside to store the information which is entered from the keyboard.
Merits 1) Simple for read and write. 2) Simple in design and implementation 3) Command and responses are interleaved. Demerits 1) Not user friendly 2) Context of the text is not displayed. 3) Only single line
Stream Editors
Views the entire text as a stream of characters, & permits edit operation to cross line boundaries It support character, line & context oriented editing commands. Current editing context is indicated by the position of the text pointer called cursor. Cursor can be used to move across & within the lines. Cursor can be moved by using positioning & search commands.
Screen Editors
It uses what-you-see- is what-you-get mode It displays a screen full of text at a time. User can move the cursor over the screen, position it on a point, where the editing process is to be performed. Effect of edit operation can be seen on the screen. Useful while formatting the text to produce printed documents.
Word processors
Document editors with additional features to produce well formatted hard copy output. Features
Commands for moving section of text from one place to another Merging of text Searching words Replacing words Spell checking
Structure Editors
Incorporates an awareness of the structure of a document Useful in browsing through a document & editing it Structure is specified while creating or modifying the document Editing requirement is specified using structure.
Editing Process
Document-editing process is an interactive user-computer dialogue designed to accomplish 4 tasks.
1. Select the part of the target document to be viewed and manipulated. 2. Determine how to format this view on-line & how to display it. 3. Specify & execute operations that modify the target document. 4. Update the view appropriately.
Travelling
Moving through the editing document to a new position in the text. Done explicitly by the user It specifies where the area of interest is;
Editing
Adding new text Modifying the existing text Erasing the content Formatting the existing data
Editor Structure
Editing component Traveling component input
Command language processor
Editing buffer
Viewing component
Viewing buffer
Viewing filter
Editing manager
Start of the area to be edited is determined by the current editing pointer maintained by the editing manager. Current editing pointer can be set or reset explicitly by the user with traveling commands such as next paragraph, or implicitly as a side effect of the previous edit operation as delete paragraph.
Traveling manager
Setting of the current editing and viewing pointers. Invoked explicitly by the user or implicitly by editing operations.
Viewing Manager
Start of the area to be viewed is determined by current viewing pointer. It is maintained by viewing manager, which is collection of modules responsible for determining the next view. Current viewing pointer can be set or reset explicitly by the user or implicitly by the system as a result of the previous edit operation.
Display Manager
Makes provision for appropriate display of text. Its function may be combined with viewing manager.
Viewing Filter
To update display, viewing manager invokes the viewing filter. It filters the document to generate a new buffer with content for viewing.
Viewing Buffer
Has the content for viewing. This content is passed to the viewing manager, which produces the display by mapping the buffers content to a window.
Editing filter
Filtering is the process of selection of contiguous characters beginning from the current position. When the user issues an edit command, the editing manager invokes the editing filter. This filter filters the document to generate a new buffer with content for editing. As editing is performed, editing filter reflects the changes into the internal form & updates the contents of the viewing buffer inorder to make the changes visible on the screen. Support an undo function by storing a stack of previous views.
Editing buffer
Editing filter creates an editing buffer that contains the portion of document selected by the user, for editing.
A text editor is a type of program used for editing plain text files.Often provided with operating systems.
Line Editor Scope of edit operations is limited to a line of text. The line is designated positionally. Advantage:Simplicity Disadvantage:Does not display the text in the manner it would appear if printed
Stream Editor Views the entire text as a stream of characters. This permits edit operations to cross line boundaries. Support character , line and context oriented commands based on the current editing context indicated by the position of a text pointer.
Screen Editor A screen editor uses the what you see is what you get principle in editor design. The user can move the cursor over the screen, position it at the point where he desires to perform some editing and proceed with the editing directly. Advantage:-Useful while formatting the text to produce printed documents.
Word Processors Basically document editors with additional features to produce well formatted hard copy output. Essential features of word processors are commands for moving sections of text from one place to another, mergingof text, and searching and replacement of words. Many word processors support a spell check option.e.g. Wordstar
Structure Editors Incorporates an awareness of the structure of a document. Structure is specified by the user while creating or modifying the document. Editing requirements are specified using thestructure. A special class of structure editors , called syntax directed editors, are used in programming environments.
Advantages and Disadvantages Text Editor Simple and places less demands on system . Provides greater control over the application Difficult to Visualise output(e.g: to preview a webpage you have to have a suitable browser) Dependant on programming or text-based commands knowledge