SlideServe
Menu
Préférences
© SlideServe · v2026

Essential Guide to C Programming Development Cycle

jcassandra avatar
13 diapositives · 228 Views · Jan 05, 2020

Learn the complete C program development process, from designing to optimizing, packaging, and compiling with GCC. Understand the steps involved in creating a C program from scratch.

Essential Guide to C Programming Development Cycle - slide 1
01 / 13Essential Guide to C Programming Development Cycle
1 / 17

Télécharger la présentation

Essential Guide to C Programming Development Cycle
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. C Development Environment

  2. Life Cycle of a C program Development Designing [Your Brain™] Editing [xemacs , vi ?!] Compiling [gcc] Code Checking [lint, smash] Testing / Debugging [gdb , gof printf] Purifying [e-fence, valgrind , purify] Profiling & Optimizing [gcov , gprof] Packaging [deb , rpm]

  3. Compiling with GCC #include <stdio.h> int main ( ) { printf (“hi\n”); } hw GCC -o hw hw.c Executable File Source code File hw.c Let’s get it done the simplest way first

  4. Compiling with GCC in one step hw.c hw gcc -o hw hw.c Source File Executable File [tux:~/hw]: GCC -o hw hw.c [tux:~/hw]: ls -l hw -rwxr-xr-x 1 gaspara voicedb 13877 Aug 8 15:05 hw [tux:~/hw]: ./hw hi [tux:~/hw]: file hw hw: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), not stripped [tux:~/hw]: more /usr/share/magic

  5. Compiling with GCC in two steps hw.c hw.o gcc -c hw.c Object File Source File hw gcc -o hw hw.o Executable File [tux:~/hw]: GCC -c hw.c [tux:~/hw]: ls -l hw.o [tux:~/hw]: file hw.o [tux:~/hw]: GCC -o hw2 hw.o [tux:~/hw]: ls -l hw hw2 [tux:~/hw]: file hw2

  6. What’s behind GCC ? hw.c hw.i cpp0 Preprocessor Expanded Source File Source File Compiler hw.s ccl asm File Other User .o Files Assembler hw.o as obj File Link Editor / Linker /usr/lib Libraries hw ld collect2 Exec File

  7. More Informations about GCC ? hw.i Expanded Source File Different Types of Files’ Extensions are detailed in man gcc Similarly, options to stop GCC at any step of the source code processing chain are available -c Stops after hw.o -S Stops after hw.s -E Stops after hw.i hw.s Asm File hw.o Obj File hw Exec File

  8. Precompiling hw.i Contents of /usr/include/stdio.h Expanded Source File #include <stdio.h> int main ( ) { printf (“hi\n”); } int main ( ) { printf (“hi\n”); } hw.s Asm File hw.o Source code File hw.c Expanded Source File hw.i Obj File hw cpp GCC -E hw.c Exec File

  9. Compiling hw.i (…) main: pushl %ebp movl %esp, %ebp subl $8, %esp subl $12, %esp pushl $.LC0 call printf addl $16, %esp (…) Contents of /usr/include/stdio.h Expanded Source File hw.s int main ( ) { printf (“hi\n”); } Asm File hw.o Expanded Source File hw.i Asm Source File hw.s Obj File hw ccl GCC -S hw.c Exec File

  10. Assembling hw.i (…) main: pushl %ebp movl %esp, %ebp subl $8, %esp subl $12, %esp pushl $.LC0 call printf addl $16, %esp (…) Expanded Source File hw.o hw.s Obj File GCC -c hw.c Asm File as Asm Source File hw.s hw.o Relocatable Object File = assembled asm code (architecture dependent) = ELF32_i386 format (linux) Ready for link w/ other obj to form an executable file Obj File hw Exec File

  11. Linking hw.i hw Expanded Source File hw.o Exec File Obj File hw.s ld Asm File hw.o GCC -o hw hw.c Gathering altogether Your Object Files Object Files from libraries The C runtime code Obj File hw Exec File

  12. Linking hw.i hw hw.o ld Expanded Source File Exec File Obj File A taste of what linking is really about… (edited) ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hw /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/ hw.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o hw.s Asm File hw.o Obj File hw Exec File

  13. Blank Slide…