Unit-5 notes for system software

download Unit-5 notes for system software

of 8

Transcript of Unit-5 notes for system software

  • 8/8/2019 Unit-5 notes for system software

    1/8

    UNIT 5 INTRODUCTION TO A TEXT EDITOR &DEBUGGING SYSTEM

    Structure

    5.0 Introduction5.1 Objectives5.2 Introduction to Text Editor

    5.2.1 Ove rview o f the Edit ing Process5 .2 .2 Type s of Editors and User Interface5.2.3 Editor Structur e5 .3 In teract ive Debugging Systems5.3.1 Debu gging Functions and Capabil i t ies5 .3 .2 Relationship with O ther Parts of the System5.3.3 User Interface Criteria5 .4 S ummary

    5.5 model Answers5.6 Further Read ings

    5.0 INTRODUCTIONIn the previous unit we discussed several types of system software such as compiler, l inker, loaderand operating system. W e also presented a detailed description of Unix operating system. In thisunit, we take up issues related to a text editor and a debugging system .A text editor is a program that enables you to create and edit text files. Th e distinction betwe eneditors and word processors is not clear-cut, but in general , word processors provide m any m oreformatting features.lnteractive program debugging system provides programmers with facilities that aid in the testingand debugging o f programs. Although the desirabil ity of such systems has been recognised forso me time, there are relatively few actua l debug ging system s in practical use.

    5.1 OBJECTIVESAfter comple tion o f this unit, you should be able to:

    Defin e a text editorDiscuss the general appro aches used in text editorsDefine interactive debugging system s

    i Discu ss the fu nctions and chara cteristics that are likely to be important in the futuredevelopment of debugging system software.

  • 8/8/2019 Unit-5 notes for system software

    2/8

    Programming Cpncepts& Software Tools

    I .5.2 INTRODUCTION TO A TEXT EDITORThe interactive text editor has become an important aspect of almost any computing environmeNo longer are editors thought af as tools for programmers. It is now increasingly recognised thtext editor should be considered the primary interface to the computer for all types of "knowledworkers" as they compose, organise, study and manipulate computer-based information.An interactive editor is a computer program that allows a user to create and revise a targetdocument. The term document includes objects such as computer programs, text, equation, tablinker, loader and Operating System, diagrams, line art and photographs; anything that one mighfind on a printed page: A text editor is a program in which the primary elements being edited acharacter strings of the target text. We also presented a detailed descriptive of Unix operatingsystem. In this unit, we take up issues related to a Text Editor and a Debugging system.

    5.2.1 Overview of the Editing ProcessThe document-editing process is an interactive user-computer dialogue designed to accomplishtasks:1) Select the part of the target document to be viewed and manipulated2) Determine how to format this view on-line and how to display it3) Specify and execute operations that modify the target document4) Update the view appropriately.Editing phase involves how the target document is created or altered with a set of operations suas insert, delete, replace, move and copy. The editing functions are often specialised to operateelements meaningful to the type of editor.For example, a manuscript-oriented editor might operate on elements such as single characters,words, lines, sentences and paragraphs.

    5.2.2 Types of Editors and User InterfaceThere are many types of editors, but they fall into two general categories:

    Line editors: A primitive form of editor that requires you to specify a specific line of textbefore you can make changes to it.Screen oriented editors: Also called full screen editors, these editors enable you to modify text that appears on the display screen by moving the cursor to the desired location.

    The user of an interactive editor is presented with a conceptual model of the editing system. Thmodel is an abstract fiamework on which the editor and the world on which it operates are baseThe conceptual model, in essence provides an easily understood abstractions of the target docuand its elements, with a set of guidelines describing the effects of operations on these elementsBesides the conceptual mode, the user interface is concerned with the input devices, the outputdevices and the interaction language of the system.

  • 8/8/2019 Unit-5 notes for system software

    3/8

    1npG devices are used to enter elements of the text being edited, to enter commands and to Introduction to adesignate ediuble elements. These devices as used with editors, can be divided into three Editor & DebuggSystemcategories-Text or string devices: Typically typewriter-like keyboards on which a user presses and releaseskeys, sending a unique code for each key.Button or choice devices: Generate an interrupt or set a system flag, usually causing invocation of .an associated application-program action. Such devices incldde a set of special function keys on analphanumeric keyboard or on the display itself.Locator devices: These are two dimensional anaiog to digital converters that position a cursor -symbol on the screen by observing the user's movements of the device. Such devices includejoysticks, touch screen panels, data tablets anckmouse.A locator device combined with a button device allows the user to specify either a particular pointon the screen at which text should be inserted or deleted, or the start and end points of a string ofcharacters to be operated upon.Text devices with arrow (cursor) keys are often used to simulate locator devices. Each of thesekeys shown are- arrow that points up, down, left or right. An advanced input device namely voice-input device is now available, which translates spoken words to their textual equivalents, may proveto be the text devices of the future. Because of their limitations and high cost, voice recognisesystems have been used only in a few specialised situations. 4Output devices serves to let the user view the elements being edited and the results of the editingoperations. Advanced CRT terminals use hardware assistance for such features as moving thecursor, inserting and deleting characters and lines, and scrolling lines and pages. The newprofessional workstations based on personal computers with high resolution displays, supportmultiple proportionally spaced character fonts to produce realistic fascimiles of hard copydocuments.The interaction language of a text editor is generally one of several common types. The typingoriented or text command-oriented method is the oldest of the major editor interfaces. The usercommunicates with the editor by typing text strings both'for command names and for operands.These strings are sent to the editor and are usually displayed to the output device. The function keyinterface method is the other method in which each command has associated with it a marked keyon the user's keyboard. Function-key command specification is typically coupled with cursor-keymovement for specifying operands, which eliminates much typing. For the common commands ina function-key editor, usually only a single key need be pressed. The menu-oriented user interfaceis a multiple-choicessetof text strings or icons, which are graphic symbols that represent objects oroperations. The editor prompts the user with.a menu of only those actions that can be taken at thecurrent state of the system.Typing oriented systems require familiarity with the system and language, as well as some expertisein typing. Function-key oriented systems often have either too few keys, requiring multiplekeystroke commands, or have too many unique keys, which results in a unwieldy keyboard. Theproblem with a menu-oriented system can arise when there are many possible actions and severalchoices are required to complete an action. The display area for the menu is rather limited.

  • 8/8/2019 Unit-5 notes for system software

    4/8

    Programming Concepts 5.2.3 Editor Structuredi Software 'Tools

    I t , Iditing 4 EditingModule .... burner Page EditinglanguageProcessor

    ViewingFilterModule !ainMemory/RAMI odule I_ 1'ViewingModule buffer PageOutput l letices Display

    Module h a r d d i s k

    PageTransfer

    I I 1 I

    .................. . ....Control DataFigure: Typical editor structure

    Mo st text editors have a structure similar to the above figure. The com mand languag e processoracc epts input from the use r's input devices, and analyses the tokens and syntactic structure of thecom ma nds. In this sense, the comm and language processor functions much like the lexical andsyntactic phases of a compiler. Just as in a comp iler, the com mand language processor ma y invokeseinailtic routines directly. In a text editor, these sema ntic routines perform functions suc h asediting and viewing. Alternatively, the command language processor may produce an interme diaterepresentation of the desired editing operations. This intermediate representation is then decod edby an interpreter that invokes the appropriate seman tic routines. The u se of an intermediaterepresentation allows the ed itor to provide a variety o f user-interaction language s with a single setof semantic routines that are driven from a com mon intermediate represen tation.Th e sema ntic routines involve travelling, editing, viewing, and display functions. In editing adocum ent, the start of the area to be edited is determined by th e current editingpointer maintainedby the editing module, which is the collection of modules dealing with editing tasks. Th e currentediting pointer can be set or reset explicitly by the user with travelling comm and s, such as nextparagraph and next screen, or implicitly by the system a s a side effect of the previou s editingoperation, such as delete paragraph. The travelling module of the editor actually performs thesetting of the current editing and viewing pointers.When the user issues an editing comma nd, the editing module invokes the editing$lter. Thiscomp onent filters the document to generate a new editing buffer based on the cu rrent editing pointer'as well as on the editing filter parameters. These parameters, which are specified both by the userand the system , provide such information as the range of text that can be affected by an o peration.Filtering may simply con sist of the selection of contiguous characters be ginning at the currentpoint. The sem antic routines of the editing componen t then operate on the editing buffer, which isesse~ ltially filtered subset of the document data structure.Similarly, in viewing a docume nt, the start of the area to be viewe d is determined by the currentviewingpointer. This pointer is maintained by the viewing module of the editor, which is acollec tio~l f modules responsible for determining the next view. The current viewing pointer canbe set or reset explicitly by the user with a travelling com ma nd o r implicitly by the system a s aresult of the previous editing operation. When the display needs to be updated, the viewingcomp onent invokes the viewing module. This component filters the docum ent to generate a newviewing bufferbased on the current viewing pointer as well as on the viewing filter parameters.I11 line editors, the viewing buffer can contain the cu rrent line; in screen editors, this buffer maycontain a rectangu lar cutout of the quarter-plane of text. Th is viewing b uffer is then passed to the

  • 8/8/2019 Unit-5 notes for system software

    5/8

    display module of the editor, which produces a display by mapping the buffer to a rectangularsubset of the screen, called a window or viewport.The editing and viewing buffers, while independent, can be related in many ways. In the simplestcase, they are identical: the user edits the material directly on the screen, as is in the followi~lgfigure.

    Current editing painterCurrent viewing painterLigure: Sim ple relationship between editing and viewing buffers

    The editing and viewing buffers can also partially overlap, or one may be completely contailled inI the other.

    Windows typically cover either the entire screen or a rectangular portion of it. Mapping viewingbuffers to windows that cover only part of the screen is especially useful for editors on moderngraphics-based workstations. Such systems can support multiple windows, simultaneously showi~~gdifferent potioils of the same file or portions of different files. This approach allows the user toII perform inter-file editing operations much more effectively than with a system having on14 a singleI window.

    The mapping of the viewing buffer to a window is accomplished by hvo co~nponents f the system.First, the viewing component formulates an ideal view, often expressed in a device-independentintermediate representation. This view may be a very simple one consisting of a window's worth oftext arranged so that lines are not broken in the middle of words. At the other extreme, tlieidealized view may be a facsimile of a page of fully formatted and typeset text with equations,tables, and figures. Second, the display module takes this idealized view from the viewingcomponent and maps it to a physical output device in the most efficient manner possible.

    System

    INTERACTIVE DEBUGGING SYSTEMS

    An interactive debugging system provides programmers with facilities that aid in the testing anddebugging of programs.5.3.1 Debugging Functions and CapabilitiesThe most obvious requirement is for a set of unit test functions that can be specified by theprogrammer. One important group of such functions deals with execution sequencing, which is tlieobservation and control of the flow of program execution. After execution is suspended, otherdebugging conlmands can be used to analyse the progress of tlie progrm and to diagnose error1 detected; then execution of the program can be resumed. Given a good graphic representation ofI program progress, it may even be useful to enable the program to run at various speeds called gaits.

  • 8/8/2019 Unit-5 notes for system software

    6/8

    Programing Concepts A deb ugging system should also provide function such as trac ini and traceback. Tracing can b e .&,SoftwareTOOIS used to track the flow of execution logic and data modifications. The con trol flow can be traced a t

    i ' different Ievels of detail namely module, subroutine, branch instruction and so o n. raceb back canshow the path by which the current statement is reached. For a given variable or parameter,tracebac k can show which statemen ts modified it. Such information should be displayed asymbolically.It is also important for a debugging system to have good program display capabilities. It must bepossible to display the program being debugged, complete with statement numbers. Th e sjrstein, 'should sav e all the debugging specifications for a recompilation, so the programmer does n ot needto reissue all of these debugging commands. A deb ugging system should consider the language inwhich the program being debugged is written. Debugger com man ds that initiate actions and collectdata about a program's executiim should be commo n across languages. How ever, a debug gingsysJem m ust be sensitive to the specific language being debugg ed, s o that procedural, arithmeticand conditional logic can be coded in the syntax of that language.The se requirements have a number of consequences for the debugge r and for the other software.Wh en the deb ugger receives control, the execution of the program being d ebugged is temporarilysuspend ed. Th e debugger must then be able to determine the language in which th e program iswritten and set its context accordingly.Th e notation used to specify certain debugging functions varies according to the language of theprogra& being debugged. The debugger must have access to information gathered by the languagetranslator. The internal symbol dictionary formats vary widely between different language. translators. Future comp ilers and assemblers should aim toward a consistent interface with thedebugging system. On e approach is that the language translators to produce the needed informationin a standard external form for the debugger regardless of the internal form u sed in the translator. .Ano ther possibility would be for the language translator to provide deb ugger interface mddu'les thatcan respond to requests for information in a standard w ay regardless of the language beingdebugged. . .It is also important that a debugging syste fl be able td deal with optimized code. M any 'optimizations involve the rearrangement of segments of'code in the program. Blocks of cod e maybe rearranged to eliminate unnecessary branch instructions, which provide mo re ifficien t executionTh e user of a debugging system deals with the source program in its original form before. optimizations are performed. The debugging of optimized code requires a substantial amo unt ofcooperation from the op timizing compiler. In particular, the c ompiler must retain informationabout any transportation that it performs on the program. Such information ca n be m ade availableboth to the debu gger and to the programmer.

    5.3.2 Relationship with O ther Parts of the SystemAn interactive debugger must be related to other parts of the system in many different ways. Thesingle most important requirement for any interactive debugger is that it always be available. Whenan error is discovered, immediate debugging must be possible because it may be different orimpossible to reproduce the program failure in som e other environment o r at some other time. Th edebu gger must commynicate and cooperate with other operating system com pone nts such asinteractive subsystems.' 'Debug ging is even more imp ortant at produc tion time than it is atapplication-development time. The debugg er must also exist in a wa y that i s consistent with the ,security and integrity components o f the system. Use o f the debu gger must be subject to the normalauthorization mechanisms and must leave the usual audit trails. Th e debug ger must coordinate itsactivities with those o f existing and fature language com pilers and interpreters.

  • 8/8/2019 Unit-5 notes for system software

    7/8

    5.3.3 User Interface Criteria introductionto a T e qEditor & DebuggingSystemThe interactive debugging system should be simple in its organisation and familiar in its language., The facilities of the debugging system should be organised into a few basic categories of function,1 which shbuld closely neglect common user tasks. This simple organisation contributes greatly toi ease of training and ease of use. !I The user interaction should take advantage of full-screen terminal devices when they are available.

    The primary advantage is that a great deal of information can be displayed and changed easily andquickly.If the tasks a user needs to perform are reflected in the organisation of menus, then the system willfeel very natural to use. Menus should have titles that identify the task. Directions should precedeany choices available to the user. Techniques such as indentation should be used to help separateportions of the menu.A debugging system should also support interactive users when a screen terminal device is notpresent. Every action a user can take at a full-screen terminal should have an equivalent action in alinear debugging language.The command language should have a clear, logical, simple syntax. Commands should be simplerather than compound.There should be a consistent use of parameter names across the set of commands. Parametersshould be automatically checked for errors in such attributes as type and range of values.Commqi~dormats should be as flexible as possible. The command language should minimise theuse of such punctuation as parentheses, slashes, quotation marks and other special characters. Anygood interactive-system should have an on-line HELP facility.' HELP should be accessible fromany state of the debugging session.Check Your Progress1 . Mention the different tasks irtvolved in the document editing process.

    2 . What are the main functions of a debugging system?

  • 8/8/2019 Unit-5 notes for system software

    8/8

    Programming Concepts 5.4 SUMMARYYr Sofhvare Tools

    In this unit, we discussed functions o f two typ es of system software: Text Ed itor and debug ging.syste m. A text editor is quite commo n tool now. It is no longer a tool to be used by a prog ramm eronly. On e of the important features of the current generation of a text editor is to provide syntax-directed feature, which provides help in correcting the syntax of the language.

    5.5 MODEL ANSWERS1 . There are four tasks to be accom plished by the document editing process:

    i) Selecting- Select the part of the target document to be viewed and m anipulatedii) Formatting - Determine how to format the view on-line and how to display itiii) Modifying - Specify and execute operations that modify the target docum entiv) Updating -Update the view appropriately.2. The functions of a debugging system include:

    Observation and control of the flow of program executionAnalyse the progress of the program and to diagnose errors detectedTracing - used to track the flow o f execution logic and data mod ificationTraceback - how s the path by which th e current statemen t is reachedGoo d program d isplay capabilities.

    5.6 FURTHER READINGS1. System Software by Leland L . Beck, Addison-Wesley Publishing Com pany 1990.