assignment presentation 2

Upload: kartikeya-tiwari

Post on 30-May-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Assignment Presentation 2

    1/12

    A computer implemented method analyzes an execution of aprogram. The method partitions the program into programcomponents such as basic blocks and procedures.

    A source or executable representation of the program isinstrumented to collect test coverage data.

    In addition, a flow graph representing the program componentsis generated.The program is then executed to collect test coverage data.

    Using the test coverage data and the flow graph, the program ispartitioned into executed and unexecuted components.The number of instructions in each unexecuted programcomponent is counted.

    The Input is taken from the user and an output is given out.

  • 8/14/2019 Assignment Presentation 2

    2/12

    Thus, a list of the unexecuted program componentscan be presented according to a decreasing order

    of the number of unexecutedinstructions in the unexecuted program components.

  • 8/14/2019 Assignment Presentation 2

    3/12

    Execute To execute the program means to run it. The two terms can be usedinterchangeably.

    Source code this is the code that the programmer writes in a high-level language like Java,BASIC, or, in this case, C. A high-level language is one that humans can easily read andunderstand.

    Terminal A terminal is a combination of a screen and a keyboard where the user of a program

    can type input into the program and receive output back.

    Memory Memory is where the computer stores the code text for a program, the variables, thestack, and everything else that the program needs.

    Hexadecimal The decimal system uses a base of 10, where 2863 has a 2 in the 1000s place,an 8 in the 100s place, a 6 in the 10s place, and a 3 in the 1s place. Hexadecimal uses 0, 1,

    2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F instead of just 0 through 9, where A = 10, B = 11 F = 15.The base of hexadecimal is 16, so it has a 1s place, a 16s place, a 256s place, a 4096splace, etc. 0 through 255 can be represented in hexadecimal as 0x00 through 0xFF. 0x?? is acommon convention for distinguishing hexadecimal numbers from decimal numbers.

  • 8/14/2019 Assignment Presentation 2

    4/12

    CompiledCompiled A compiler takes the source code a programmer has A compiler takes the source code a programmer has

    written and turns it into code text that a computer can easilywritten and turns it into code text that a computer can easily

    execute. Code text is a sequence of instructions.execute. Code text is a sequence of instructions.

    InstructionInstruction An instruction tells the computer what to do, but it is An instruction tells the computer what to do, but it is

    very low-level. Unlike source code, it works at the computer levelvery low-level. Unlike source code, it works at the computer leveltelling the computer what elementary steps to take to execute thetelling the computer what elementary steps to take to execute the

    program.program.

    Program counterProgram counter The instructions are stored as a sequence of The instructions are stored as a sequence of

    numbers in the computer just like anything else. The computernumbers in the computer just like anything else. The computer

    usually executes one instruction after another unless it is told tousually executes one instruction after another unless it is told tojumpjump somewhere else. The program counter keeps track of whatsomewhere else. The program counter keeps track of what

    instruction in memory is being executed at any given time.instruction in memory is being executed at any given time.

    JumpJump A jump occurs when the computer is told to start executing A jump occurs when the computer is told to start executing

    instructions somewhere else besides the next instruction after theinstructions somewhere else besides the next instruction after the

    current one being executed.current one being executed.

    CanaryCanary A canary is put in memory and if it is overwritten then A canary is put in memory and if it is overwritten then

    something is wrong. It is analogous to the canaries used in coalsomething is wrong. It is analogous to the canaries used in coal

    mines to detect poisonous gas.mines to detect poisonous gas.

  • 8/14/2019 Assignment Presentation 2

    5/12

    Programming Language, in computer science,Programming Language, in computer science,any artificial language that can be used toany artificial language that can be used todefine a sequence of instructions that candefine a sequence of instructions that canultimately be processed and executed by theultimately be processed and executed by thecomputer. Defining what is or is not acomputer. Defining what is or is not aprogramming language can be tricky, butprogramming language can be tricky, butgeneral usage implies that the translation ofgeneral usage implies that the translation ofinstructions written in the language into codeinstructions written in the language into code

    that the computer understands should bethat the computer understands should becompletely systematic. Indeed such acompletely systematic. Indeed such atranslation is usually carried out by computer.translation is usually carried out by computer.

  • 8/14/2019 Assignment Presentation 2

    6/12

    At a low level of description, microprocessors dealAt a low level of description, microprocessors dealexclusively with binary electronic signals. Givingexclusively with binary electronic signals. Givingan instruction to a microprocessor really involvesan instruction to a microprocessor really involves

    sending it a carefully timed series of on and offsending it a carefully timed series of on and offsignals. This sequence of signals is calledsignals. This sequence of signals is calledmachine code. The code usually representsmachine code. The code usually representsnumbers, data, and instructions for manipulatingnumbers, data, and instructions for manipulatingthose numbers and data. A more human-those numbers and data. A more human-friendly way of understanding machine code is tofriendly way of understanding machine code is to

    give each instruction a mnemonic, such asgive each instruction a mnemonic, such asSTORE, ADD, or JUMP. The result is called anSTORE, ADD, or JUMP. The result is called anassembly languagea very low-level languageassembly languagea very low-level languagethat is specific to a particular microprocessor.that is specific to a particular microprocessor.Low-level languages, such as assembly language,Low-level languages, such as assembly language,

    produce very fast programs but are often hard toproduce very fast programs but are often hard tolearn. More importantly, programs written at alearn. More importantly, programs written at alow level are highly specific to a type oflow level are highly specific to a type ofmicroprocessor; move to a new machine and youmicroprocessor; move to a new machine and youhave to rewrite your program from scratchhave to rewrite your program from scratch..

  • 8/14/2019 Assignment Presentation 2

    7/12

    Computers are ordinarily thought of as machinesComputers are ordinarily thought of as machinesthat perform tasks such as calculation or wordthat perform tasks such as calculation or wordprocessing. Compared to the above description ofprocessing. Compared to the above description of

    what computers actually do, this is a high-levelwhat computers actually do, this is a high-levelway of looking at a computer. There is a high levelway of looking at a computer. There is a high levelof abstraction between what is asked of theof abstraction between what is asked of thecomputer and what it actually understands. In thecomputer and what it actually understands. In thesame way, there is a complex relationshipsame way, there is a complex relationshipbetween high-level languages and machine code.between high-level languages and machine code.

    High-level languages are normally easy to learnHigh-level languages are normally easy to learnbecause they are formed from parts of naturalbecause they are formed from parts of naturallanguages such as English. In BASIC, the mostlanguages such as English. In BASIC, the mostfamiliar high-level language, commands such asfamiliar high-level language, commands such asIF COUNT = 10 THEN STOP can be used whenIF COUNT = 10 THEN STOP can be used when

    you require the computer to stop if COUNT isyou require the computer to stop if COUNT isequal to 10. Unfortunately, many people findequal to 10. Unfortunately, many people findcomputers frustrating because although theycomputers frustrating because although theyappear to understand English they actually obey itappear to understand English they actually obey itin a rigid, systematic, and literally inhuman way.in a rigid, systematic, and literally inhuman way.

  • 8/14/2019 Assignment Presentation 2

    8/12

    Code (computer), in computer science, as a noun, aCode (computer), in computer science, as a noun, a

    generic term for program instructions, used in twogeneric term for program instructions, used in two

    general senses. The first sense refers to human-general senses. The first sense refers to human-

    readable source code, that is, the instructions writtenreadable source code, that is, the instructions written

    by the programmer in a programming language. Theby the programmer in a programming language. Thesecond refers to executable machine code, thesecond refers to executable machine code, the

    instructions of a program that have been convertedinstructions of a program that have been converted

    from source code to instructions that the computerfrom source code to instructions that the computer

    can understand. As a verb, to code is to write programcan understand. As a verb, to code is to write program

    instructions in a programming language.instructions in a programming language.

  • 8/14/2019 Assignment Presentation 2

    9/12

    Compile, in relation to computers, to translate allthe source code of a program from a high-level

    language into object code prior to execution of the

    program. Object code is executable machine codeor a variation of machine code. More generally,

    compiling is sometimes used to describe translatingany high-level symbolic description into a lower-

    level symbolic or machine-readable format. Aprogram that performs this task is known as a

    compiler.

  • 8/14/2019 Assignment Presentation 2

    10/12

    Translating a list of assembly language instructions(the source code) back into machine (or object) codeis a simple matter, usually carried out by a type ofprogram called a compiler. Translating high-level

    source code into machine code can be carried out byeither a more complex compiler or an interpreter. A compiler literally compiles a list of machine code

    instructions, the object code, based on the sourcecode. The resulting object code is a ready-to-run

    program that is very fast, but which may crash thecomputer. Interpreters, on the other hand, are muchslower than compilers because they do not produceobject code. Instead they scan the source code a lineat a time. Each line is translated and the equivalentmachine code executed, even if the line is read for asecond time, as in the case of programs that loopback on themselves. The result, though slow, is muchless likely to crash than a compiled program.

  • 8/14/2019 Assignment Presentation 2

    11/12

    Debugger, in computer science, a programDebugger, in computer science, a programdesigned to help in debugging another programdesigned to help in debugging another programby allowing the programmer to step through theby allowing the programmer to step through theprogram, examine data, and check conditions.program, examine data, and check conditions.

    There are two basic types of debuggers: machine-There are two basic types of debuggers: machine-

    level and source-level. Machine-level debuggerslevel and source-level. Machine-level debuggersdisplay the actual machine instructionsdisplay the actual machine instructions(disassembled into assembly language) and allow(disassembled into assembly language) and allowthe programmer to look at registers and memorythe programmer to look at registers and memorylocations. Source-level debuggers let thelocations. Source-level debuggers let the

    programmer look at the original source code (C orprogrammer look at the original source code (C orPascal, for example), examine variables and dataPascal, for example), examine variables and datastructures by name, and so on.structures by name, and so on.

  • 8/14/2019 Assignment Presentation 2

    12/12

    Executable Program, in computer science, a computerprogram that is ready to run. The term usually refers toa compiled program that has been translated intomachine code in a format that can be loaded into

    memory and run; however, for interpreted languages itcan simply refer to source code in the proper format.Most executable programs in MS-DOS have the filenameextension .EXE. To run the program, the user need onlytype the filename (without the .EXE extension) at thecommand prompt and press Enter. The user does nothave to alter the program in any way before being able

    to run it. Applications such as word-processing programsare executable programs.