SlideServe
Menu
Préférences
© SlideServe · v2026

CMSC212: Intro to Low-Level Programming Concepts

desma avatar
9 diapositives · 266 Views · Oct 23, 2014

CMSC212: Intro to Low-Level Programming Concepts. Section 0101: 9:00am – 9:50am Section 0102: 10:00am-10:50am Monday & Wednesdays Room 3118. Announcements/Reminders. Quiz #2: This Wednesday (12mins)

CMSC212: Intro to Low-Level Programming Concepts - slide 1
01 / 9CMSC212: Intro to Low-Level Programming Concepts
1 / 17

Télécharger la présentation

CMSC212: Intro to Low-Level Programming Concepts
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. CMSC212: Intro to Low-Level Programming Concepts Section 0101: 9:00am – 9:50am Section 0102: 10:00am-10:50am Monday & Wednesdays Room 3118

  2. Announcements/Reminders • Quiz #2: This Wednesday (12mins) • Reminder: Must submit versions of every project that work on at least half the public tests to pass the course (Still can submit Project #1 up until 10:00 tonight) • Today: First, the GNU Project Debugger (GDB) and its innards. Later, a worksheet (based on quiz questions from earlier semesters)

  3. GNU Project Debugger (GDB) • The main idea • Lets your step through your code “line-by-line” during execution • Lets you look/modify variables and their values during run-time • Breakpoints! • Want your program to temporary halt execution on a particular line of code, set a breakpoint • http://sourceware.org/gdb/current/onlinedocs/gdb_toc.html

  4. GNU Project Debugger (GDB) • Programs must be compiled with the option –g to be debugged with gdb • Some common commands with console gdb • r: run: runs the program from the beginning • c: cont: continues execution after breakpoint • n: next: executes next statement, steps over function calls • s: step: executes next statement, steeping into function calls • finish: completes the execution (returns from current function)

  5. GNU Project Debugger (GDB) • Breakpoints • b: break: sets a breakpoint on current line or any line • tb: tbreak: sets a temporary breakpoint on indicated line • d: delete: deletes one or all breakpoints • i b: info breakpoints: lists all currently set breakpoints

  6. GNU Project Debugger (GDB) • Looking at data • p: print: prints a variable’s current value., print/x prints in hex • info locals: prints values of current function’s local variables • display: followed by a variable name which is visible at the current position, prints the value of that variable each time the program execution stops. • undisplay: Cancels the display of variables set in prior display commands

  7. GNU Project Debugger (GDB) • Execution history • where: shows list of active functions, in order from most recent-called back to main function • up: moves up the function which called the current one (to be able to examine its data) • down: move back after calling up • If program crashes during execution (e.g. segfault, use ‘where’ to find out where it happened

  8. GDB with emacs • Hit escape-x • Type ‘gdb’ • The following may appear, just hit enter to launch: gdb –annotate=3 program.x • Begin debugging, hit r • Should see a split window of console and code • set breakpoints using cursor in the code window

  9. Other features: Look at menu ‘GuD’, “GDB-UI”, and “Display other Windows” • Gdb interaction (console) window • display of local variables in the main program • Source code • Runtime stack and current function call chain • List o breakpoints set