Software Development

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Where do you suppose the math library (libm.a) is located in the Unix operating system?

(look in /usr/lib)

Debugging

- Improper program execution necessitates correction by the programmer - Source code must be re-examined and analyzed to track down problems - Modifications are made in the editing phase and the process continues

From source code to executable what's involved?

Editing->Preprocessing->Compiling->Linking

assembly language

Programming language that has the same structure and set of commands as machine languages but allows programmers to use symbolic representations of numeric machine code.

Makefiles

Tells make how to compile and link a program.

object code

The output of the compiler after it translates the program. Machine language instructions.

assemblers

Tools that convert assembly code into the necessary machine-compatible binary language for processing activities to take place.

Compiling

Translates a program from one language to another - The compiler we'll use translates C/C++ language code to machine instructions code - Compilers first translate source code to assembly language code

Compiling with g++

https://courses.cs.washington.edu/courses/cse373/99au/unix/g++.html

Loading

- Before execution, the program must be transferred from disk to machine memory - A program called the loader automatically places the program in memory - This is done automatically when a user executes the program (by typing on command line)

Final Notes

- By default, most compilers will invoke the various phases automatically - Specifically this involves calling the preprocessor, assembler, and linker - This is evident in our last exercise above when the final program was generated - We'll be writing C/C++ code in multiple source files as well as using library functions - What compiler option do you suppose we'll be using the most? Why? - Our compiler commands will start to become longer and more complex - We'll learn that special files called Makefiles, help us organize our compilation tasks

Exercise - Compile your C code only through the preprocessor phase by executing user@machine % cc -E ex1.c

- Notice how the preprocessor has taken the contents of stdio.h and math.h and included it in the code. - Where do you suppose math.h/stdio.h are located in the Unix operating system? Look in /usr/include....! - Note also how NUM in the output has been substituted with the value specified (10)

Execution

- Once the program is loaded in memory, the CPU executes each instruction - Each of the code statements are executed sequentially in turn

Where do you suppose math.h/stdio.h are located in the Unix operating system?

/usr/include

assembly language

A(n) ____ resides between the lowest-level language and a higher-level language; it assigns letter codes to each machine language instruction. a. machine language c. class b. constructor d. assembly language

Editing

Editing - Software program to perform basic text processing tasks - Software program typically referred to as an editor - User (programmer) enters instructions in a programming language - User saves instructions or program code as a file on disk - Disk files of program code are referred to as source files - User makes necessary modifications to file - To help identify source files, suffixes are appended to the file name

Linking

Program called the linker or ld, combines or "links" other object code - Program functions not defined in source file need to be located and combined with the program object code - Other functions might be located in other object files or in collections of objects (libraries) - Linker, often invoked from the compiler, needs to know what object files or libraries to link - Successful linking phase results in the final binary program, or executable image

Preprocessing

Software program called automatically before compilation - This program, called a preprocessor, is instantiated by the compiler - Program performs special commands specified in source files - Commands usually consist of - including commands/text from other files into source file - substituting or expanding symbols in source file - Preprocessor instructions in code identified by # sign - These instructions are also referred to as preprocessor directives - Allows programmer to develop code that is easier to... - read - modify - port to other systems

linker or ld

Software that combines together a number of separate object code files.

With some compilers, this linking step may have generated an error - Linking errors can occur if the linker cannot find a particular function in your program - For example, if the compiler cannot find the math function (asin) we are using, it will generate an error - In these instances, you can instruct the linker to look in a math library for the function by executing user@machine % cc ex1.c -lm

The -lm instructs the linker to look in the math library (libm.a) for undefined functions - Note the convention used (i.e. -l(name) => link library named lib(name).a)

What compiler option do you suppose we'll be using the most?

stdio.h


संबंधित स्टडी सेट्स

Bible Doctrine Unit 1-3a Review Questions and Essays

View Set

Chapter 20 Contracts- Listing Agreements

View Set

PSYS 001 - EXAM 1 - 7.19.3 - Heuristic Processing: Availability and Representativeness

View Set

REE Ch. 14 - Contract Preparation

View Set

Arithmetic Sequences: Explicit Formula and Common difference

View Set

Chapter 2 Information Security Fundamentals Exam Questions

View Set

ISA Study Guide Chapter 1: Tree Biology

View Set