Program Design: Using the Debugger
|
|
- Willis Ramsey
- 6 years ago
- Views:
Transcription
1 rogram Design, February 2, Program Design: Using the Debugger A debugger is an alternative to putting print (printf in C) statements in your program, recompiling and trying to find out what values are set incorrectly or where the program terminates prematurely.
2 rogram Design, February 2, A debugger allows you to run your program multiple times and inspect multiple variable values without recompiling. It will indicate what line a program was executing (or what system function was called) in the case that a program terminates prematurely and unexpectedly.
3 rogram Design, February 2, To use the debugger you must compile your program with the -g option. So a compile will look like gcc -g -o exec filename or just gcc -g filename (if you want to use a.out as the executable).
4 rogram Design, February 2, To invoke the debugger type gdb a.out or gdb exec
5 rogram Design, February 2, In the debugger you can use help to find out what commands do. The primary commands you will need are 1. list this list the function you are currently in. You can list specific line numbers or specific functions.
6 rogram Design, February 2, break lnumber break lnumber sets a breakpoint at line lnumber. Then you can examine the state of your running program. 3. cont continue execution of the program. 4. step execute a single statement. 5. next execute up to the next statement (useful for skipping functions). 6. print variable prints the value of variable. 7. quit gets you out of the debugger. Now some examples of debugging modifications (errors introduced) to the program in Fig 3.8 in your book.
7 rogram Design, February 2, waterfall: gcc -g -o debug example.c 202 waterfall: gdb debug GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16 (sparc-sun-solaris2.6), Copyright 1996 Free Software Foundation, Inc... (gdb) help List of classes of commands: running -- Running the program stack -- Examining the stack data -- Examining data breakpoints -- Making program stop at certain points files -- Specifying and examining files status -- Status inquiries support -- Support facilities user-defined -- User-defined commands aliases -- Aliases of other commands obscure -- Obscure features internals -- Maintenance commands Type "help" followed by a class name for a list of commands in that class.
8 rogram Design, February 2, Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help breakpoints Making program stop at certain points. List of commands: awatch -- Set a watchpoint for an expression rwatch -- Set a read watchpoint for an expression watch -- Set a watchpoint for an expression catch -- Set breakpoints to catch exceptions that are raised break -- Set breakpoint at specified line or function clear -- Clear breakpoint at specified line or function delete -- Delete some breakpoints or auto-display expressions disable -- Disable some breakpoints enable -- Enable some breakpoints thbreak -- Set a temporary hardware assisted breakpoint hbreak -- Set a hardware assisted breakpoint tbreak -- Set a temporary breakpoint
9 rogram Design, February 2, condition -- Specify breakpoint number N to break only if COND is true commands -- Set commands to be executed when a breakpoint is hit ignore -- Set ignore-count of breakpoint number N to COUNT Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help List of classes of commands: running -- Running the program stack -- Examining the stack data -- Examining data breakpoints -- Making program stop at certain points files -- Specifying and examining files status -- Status inquiries support -- Support facilities user-defined -- User-defined commands aliases -- Aliases of other commands obscure -- Obscure features
10 rogram Design, February 2, internals -- Maintenance commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) help files Specifying and examining files. List of commands: show gnutarget -- Show the current BFD target cd -- Set working directory to DIR for debugger and program being debugged pwd -- Print working directory core-file -- Use FILE as core dump for examining memory and registers section -- Change the base address of section SECTION of the exec file to ADDR exec-file -- Use FILE as program for getting contents of pure memory file -- Use FILE as program to be debugged sharedlibrary -- Load shared object library
11 rogram Design, February 2, symbols for files matching REGEXP path -- Add directory DIR(s) to beginning of search path for object files load -- Dynamically load FILE into the running program add-shared-symbol-files -- Load the symbols from shared objects in the dynamic linker s link map add-symbol-file -- Usage: add-symbol-file FILE ADDR symbol-file -- Load symbol table from executable file FILE set gnutarget -- Set the current BFD target list -- List specified function or line reverse-search -- Search backward for regular expression (see regex(3)) from last line listed search -- Search for regular expression (see regex(3)) from last line listed ---Type <return> to continue, or q <return> to quit--- forward-search -- Search for regular expression (see regex(3)) from last line listed directory -- Add directory DIR to beginning of search path for source files
12 rogram Design, February 2, Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) list 2 sentinel-controlled repetition */ 3 #include <stdio.h> 4 5 main() 6 { 7 float average; /* new data type */ 8 int counter, grade, total; 9 10 /* initialization phase */ 11 total = 0; (gdb) list 12 counter = 0; /* processing phase */ 15 printf("enter grade, -1 to end: "); 16 scanf("%d", grade); /* Oops did not use &grade */ while (grade!= -1) { 19 total = total + grade; 20 counter = counter + 1;
13 rogram Design, February 2, printf("enter grade, -1 to end: "); (gdb) break 18 Breakpoint 1 at 0x107c4: file FIG3_8.C, line 18. (gdb) run GNU gdb 5.0 Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... (gdb) run Starting program: /home/csee2/hall/tex/progdes/ notes/debug Enter grade, -1 to end: 100 Breakpoint 1, main () at FIG3_8.C:18 18 while (grade!= -1) { (gdb) print grade $1 = (gdb) cont Continuing. Enter grade, -1 to end: -1
14 rogram Design, February 2, Breakpoint 1, main () at FIG3_8.C:18 18 while (grade!= -1) { (gdb) print grade $2 = -1 (gdb) quit The program is running. Quit anyway (and kill it)? (y or n) y 203 waterfall: exit exit
15 rogram Design, February 2, waterfall: gcc -g -o debug FIG3_8.C 202 waterfall: debug Enter grade, -1 to end: 77 Enter grade, -1 to end: 88 Enter grade, -1 to end: -1 Segmentation fault 203 waterfall: gdb debug GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16 (sparc-sun-solaris2.6), Copyright 1996 Free Software Foundation, Inc... (gdb) run Starting program: /home/cs2/faculty/hall/ tex/progdes/notes/debug Enter grade, -1 to end: 77 Enter grade, -1 to end: 99 Enter grade, -1 to end: -1 Program received signal SIGSEGV, Segmentation fault.
16 rogram Design, February 2, x10854 in main () at FIG3_8.C:28 28 average[2000] = (float) total / counter; (gdb) print counter $1 = 2 (gdb) print average[2000] Cannot access memory at address 0xf00010e8. (gdb) print average[0] $2 = 0 (gdb) list 10 5 main() 6 { 7 float average[9]; /* new data type */ 8 int counter, grade, total; 9 10 /* initialization phase */ 11 total = 0; 12 counter = 0; /* processing phase */ (gdb) list 15 printf("enter grade, -1 to end: "); 16 scanf("%d", &grade); while (grade!= -1) { 19 total = total + grade; 20 counter = counter + 1;
17 rogram Design, February 2, printf("enter grade, -1 to end: "); 22 scanf("%d", &grade); 23 } 24 (gdb) list 25 /* termination phase */ 26 if (counter!= 0) { average[2000] = (float) total / counter; 29 printf("class average is %.2f", average[0]); 30 } 31 else 32 printf("no grades were entered\n"); return 0; /* indicate program ended successfully */ (gdb) quit The program is running. Quit anyway (and kill it)? (y or n) y 204 waterfall: exit exit
GDB Linux GNU Linux Distribution. gdb gcc g++ -g gdb EB_01.cpp
B Linux GDB GDB Linux GNU GPL Linux Distribution Linux E-B.1 gcc g++ -g EB_01.cpp EB_01.cpp E/EB/EB_01.cpp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /**** :EB_01.cpp : *****/ #include
More informationThe Dynamic Debugger gdb
Introduction The Dynamic Debugger gdb This handout introduces the basics of using gdb, a very powerful dynamic debugging tool. No-one always writes programs that execute perfectly every time, and while
More informationUsing gdb to find the point of failure
gdb gdb is the GNU debugger on our CS machines. gdb is most effective when it is debugging a program that has debugging symbols linked in to it. With gcc and g++, this is accomplished using the -g option,
More informationGDB QUICK REFERENCE GDB Version 4
GDB QUICK REFERENCE GDB Version 4 Essential Commands gdb program [core] debug program [using coredump core] b [file:]function run [arglist] bt p expr c n s set breakpoint at function [in file] start your
More information1. Allowed you to see the value of one or more variables, or 2. Indicated where you were in the execution of a program
CS0449 GDB Lab What is a debugger? A debugger is a program that helps you find logical mistakes in your programs by running them in a controlled way. Undoubtedly by this point in your programming life,
More informationECE/ME/EMA/CS 759 High Performance Computing for Engineering Applications
ECE/ME/EMA/CS 759 High Performance Computing for Engineering Applications Elements of Program Debugging Dan Negrut, 2017 ECE/ME/EMA/CS 759 UW-Madison Debugging on Euler [with gdb] Slides on gdb include
More informationCSE123 LECTURE 3-1. Program Design and Control Structures Repetitions (Loops) 1-1
CSE123 LECTURE 3-1 Program Design and Control Structures Repetitions (Loops) 1-1 The Essentials of Repetition Loop Group of instructions computer executes repeatedly while some condition remains true Counter-controlled
More informationGDB 1 GDB 2 GDB. Fortran Pascal GDB 4. hoge.c. Fig. 1. calc.c. Fig GDB. GDB Debian. # apt-get install gdb
2003 advanced seminar Intelligent Systems Design Lab. 1 GDB 2003 3 31 : GDB GDB GDB 1 GDB GDB ( ) Free Software Foundation(FSF) GDB 5.3 C,C++ 1 Fortran Pascal GDB 4 GDB 2 GDB Fig. 1 hoge.c calc.c GDB Fig.
More informationStructured Program Development in C
1 3 Structured Program Development in C 3.2 Algorithms 2 Computing problems All can be solved by executing a series of actions in a specific order Algorithm: procedure in terms of Actions to be executed
More informationARM DS-5. Debugger Command Reference. Copyright 2010 ARM. All rights reserved. ARM DUI 0452A (ID070310)
ARM DS-5 Debugger Command Reference Copyright 2010 ARM. All rights reserved. ARM DUI 0452A () ARM DS-5 Debugger Command Reference Copyright 2010 ARM. All rights reserved. Release Information The following
More informationDS-5 ARM. Debugger Command Reference. Version 5.3. Copyright 2010 ARM. All rights reserved. ARM DUI 0452C (ID112910)
ARM DS-5 Version 5.3 Debugger Command Reference Copyright 2010 ARM. All rights reserved. ARM DUI 0452C () ARM DS-5 Debugger Command Reference Copyright 2010 ARM. All rights reserved. Release Information
More informationUsing the Debugger. Michael Jantz Dr. Prasad Kulkarni
Using the Debugger Michael Jantz Dr. Prasad Kulkarni 1 Debugger What is it a powerful tool that supports examination of your program during execution. Idea behind debugging programs. Creates additional
More informationDebug for GDB Users. Action Description Debug GDB $debug <program> <args> >create <program> <args>
Page 1 of 5 Debug for GDB Users Basic Control To be useful, a debugger must be capable of basic process control. This functionally allows the user to create a debugging session and instruct the process
More informationDS-5 ARM. Debugger Command Reference. Version Copyright ARM. All rights reserved. ARM DUI 0452P (ID091713)
ARM DS-5 Version 5.16 Debugger Command Reference Copyright 2010-2013 ARM. All rights reserved. ARM DUI 0452P () ARM DS-5 Debugger Command Reference Copyright 2010-2013 ARM. All rights reserved. Release
More informationCMPSC 311- Introduction to Systems Programming Module: Debugging
CMPSC 311- Introduction to Systems Programming Module: Debugging Professor Patrick McDaniel Fall 2016 Debugging Often the most complicated and time-consuming part of developing a program is debugging.
More information1 A Brief Introduction To GDB
1 A Brief Introduction To GDB GDB, the GNU Project debugger, allows you to see what is going on inside another program while it executes or what another program was doing at the moment it crashed. GDB
More informationChapter 3 Structured Program Development
1 Chapter 3 Structured Program Development Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 3 - Structured Program Development Outline 3.1 Introduction
More informationCMPSC 311- Introduction to Systems Programming Module: Debugging
CMPSC 311- Introduction to Systems Programming Module: Debugging Professor Patrick McDaniel Fall 2014 Debugging Often the most complicated and time-consuming part of developing a program is debugging.
More informationALD Assembly Language Debugger Copyright (C) Patrick Alken
ALD Assembly Language Debugger 0.1.7 Copyright (C) 2000-2004 Patrick Alken To run type ald help Commands may be abbreviated. If a blank command is entered, the last command is repeated. Type `help '
More informationChapter - 17 Debugging and Optimization. Practical C++ Programming Copyright 2003 O'Reilly and Associates Page 1
Chapter - 17 Debugging and Optimization Practical C++ Programming Copyright 2003 O'Reilly and Associates Page 1 Debugging Techniques Divide and conquer Debug only code Debug Command Line Switch Note: Use
More informationScientific Programming in C IX. Debugging
Scientific Programming in C IX. Debugging Susi Lehtola 13 November 2012 Debugging Quite often you spend an hour to write a code, and then two hours debugging why it doesn t work properly. Scientific Programming
More informationARM DS-5. Using the Debugger. Copyright 2010 ARM. All rights reserved. ARM DUI 0446A (ID070310)
ARM DS-5 Using the Debugger Copyright 2010 ARM. All rights reserved. ARM DUI 0446A () ARM DS-5 Using the Debugger Copyright 2010 ARM. All rights reserved. Release Information The following changes have
More informationCS/COE 0449 term 2174 Lab 5: gdb
CS/COE 0449 term 2174 Lab 5: gdb What is a debugger? A debugger is a program that helps you find logical mistakes in your programs by running them in a controlled way. Undoubtedly by this point in your
More informationUnix and C Program Development SEEM
Unix and C Program Development SEEM 3460 1 Operating Systems A computer system cannot function without an operating system (OS). There are many different operating systems available for PCs, minicomputers,
More informationData and File Structures Laboratory
Tools: GDB, Valgrind Assistant Professor Machine Intelligence Unit Indian Statistical Institute, Kolkata August, 2018 1 GDB 2 Valgrind A programmer s experience Case I int x = 10, y = 25; x = x++ + y++;
More informationLaboratory 1 Semester 1 11/12
CS2106 National University of Singapore School of Computing Laboratory 1 Semester 1 11/12 MATRICULATION NUMBER: In this lab exercise, you will get familiarize with some basic UNIX commands, editing and
More informationCSE 410: Systems Programming
CSE 410: Systems Programming Recitation 4: Introduction to gdb Introduction The GNU Debugger, or gdb, is a powerful symbolic debugger. Symbolic debuggers are available for many languages and platforms,
More informationIntro to Segmentation Fault Handling in Linux. By Khanh Ngo-Duy
Intro to Segmentation Fault Handling in Linux By Khanh Ngo-Duy Khanhnd@elarion.com Seminar What is Segmentation Fault (Segfault) Examples and Screenshots Tips to get Segfault information What is Segmentation
More informationdbx90: Fortran debugger March 9, 2009
dbx90: Fortran debugger March 9, 2009 1 Name dbx90 a Fortran 90/95 debugger for use with the NAG Fortran compiler. 2 Usage dbx90 [option]... executable-file 3 Description dbx90 is a Fortran 90/95 debugger
More informationIntroduction to the Command line. Introduction to the command line. Introduction to the Command line. GNU/Linux at South Wales
Introduction to the command line slide 1 Introduction to the Command line slide 2 in this module we will examine: tools necessary to develop game engines:gdb, emacs and friends examine how one can integrate
More informationGDB Tutorial. University of Waterloo
GDB Tutorial University of Waterloo Version 1.1 Caroline Kierstead and Peter A. Buhr c 1993 May 1, 2000 Permission is granted to make copies for personal or educational use 2 GDB Tutorial Contents 1 Introduction
More informationExercise Session 6 Computer Architecture and Systems Programming
Systems Group Department of Computer Science ETH Zürich Exercise Session 6 Computer Architecture and Systems Programming Herbstsemester 2016 Agenda GDB Outlook on assignment 6 GDB The GNU Debugger 3 Debugging..
More informationCSE 351. GDB Introduction
CSE 351 GDB Introduction Lab 2 Out either tonight or tomorrow Due April 27 th (you have ~12 days) Reading and understanding x86_64 assembly Debugging and disassembling programs Today: General debugging
More informationDevelopment Environment & Linux Guide
Development Environment & Linux Guide Juwon Lee(jwlee@archi.snu.ac.kr) School of Computer Science and Engineering Seoul National University Development Environment MobaXterm Provide Linux-like environment
More informationProblem Set 1: Unix Commands 1
Problem Set 1: Unix Commands 1 WARNING: IF YOU DO NOT FIND THIS PROBLEM SET TRIVIAL, I WOULD NOT RECOMMEND YOU TAKE THIS OFFERING OF 300 AS YOU DO NOT POSSESS THE REQUISITE BACKGROUND TO PASS THE COURSE.
More informationCS 314 Principles of Programming Languages. Lecture 9
CS 314 Principles of Programming Languages Lecture 9 Zheng Zhang Department of Computer Science Rutgers University Wednesday 5 th October, 2016 Zheng Zhang 1 CS@Rutgers University Class Information Homework
More informationEW The Source Browser might fail to start data collection properly in large projects until the Source Browser window is opened manually.
EW 25462 The Source Browser might fail to start data collection properly in large projects until the Source Browser window is opened manually. EW 25460 Some objects of a struct/union type defined with
More informationUnderstanding the Program Run
0/45 Understanding the Program Run Andreas Zeller Lehrstuhl Softwaretechnik Universität des Saarlandes, Saarbrücken Isolating Failure Causes 1/45 So far, we have seen how to isolate causes in the environment
More information12. Debugging. Overview. COMP1917: Computing 1. Developing Programs. The Programming Cycle. Programming cycle. Do-it-yourself debugging
COMP1917 12s2 Debugging 1 COMP1917: Computing 1 12. Debugging Overview Programming cycle Do-it-yourself debugging Debugging withgdb Nastier bugs Memory leaks COMP1917 12s2 Debugging 2 Developing Programs
More informationUNIX Makefile. C Project Library Distribution and Installation.
UNIX Makefile C Project Library Distribution and Installation. Tarballs Most non-package software is distributed in source code format. The most common format being C project libraries in compressed TAR
More informationPrinceton University COS 217: Introduction to Programming Systems GDB Tutorial and Reference for x86-64 Assembly Language
Princeton University COS 217: Introduction to Programming Systems GDB Tutorial and Reference for x86-64 Assembly Language Part 1: Tutorial Motivation Suppose you're developing the power.s program. Further
More informationLab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them.
Lab 8 Each lab will begin with a recap of last lab and a brief demonstration by the TAs for the core concepts examined in this lab. As such, this document will not serve to tell you everything the TAs
More informationCS 270 Systems Programming. Debugging Tools. CS 270: Systems Programming. Instructor: Raphael Finkel
Debugging Tools CS 270: Systems Programming Instructor: Raphael Finkel Gdb: The Gnu debugger It runs on most computers and operating systems. It allows you to examine a running executable program. It does
More informationWe first learn one useful option of gcc. Copy the following C source file to your
Lecture 5 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lab 5: gcc and gdb tools 10-Oct-2018 Location: Teaching Labs Time: Thursday Instructor: Vlado Keselj Lab 5:
More informationSource level debugging. October 18, 2016
Source level debugging October 18, 2016 Source level debugging Source debugging is a nice tool for debugging execution problems; it can be particularly useful when working with crashed programs that leave
More informationCSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 11 gdb and Debugging (Thanks to Hal Perkins)
CSE 374 Programming Concepts & Tools Brandon Myers Winter 2015 Lecture 11 gdb and Debugging (Thanks to Hal Perkins) Hacker tool of the week (tags) Problem: I want to find the definition of a function or
More informationThe First Real Bug. gdb. Computer Organization I McQuain
The First Real Bug 1 Debugging vs Testing 2 Software testing is any activity aimed at evaluating an attribute or capability of a program and determining whether it meets its specified results All about
More informationDebugging and Debugger. Terminology. GNU gcc and gdb. Debugging C programs in Unix and Windows Environments - Part One
Debugging C programs in Unix and Windows Environments - Part One ICT106 Fundamentals of Computer Systems Eric Li Debugging and Debugger The process of finding bugs in code called Debugging; A must-have
More informationCS354 gdb Tutorial Written by Chris Feilbach
CS354 gdb Tutorial Written by Chris Feilbach Purpose This tutorial aims to show you the basics of using gdb to debug C programs. gdb is the GNU debugger, and is provided on systems that
More informationProfilers and Debuggers. Introductory Material. One-Slide Summary
Profilers and Debuggers #1 Introductory Material First, who doesn t know assembly language? You ll get to answer all the assembly questions. Yes, really. Lecture Style: Sit on the table and pose questions.
More informationECE 3210 Laboratory 1: Develop an Assembly Program
ECE 3210 Laboratory 1: Develop an Assembly Program Spring 2018 1 Objective To become familiar with the development system s software: screen editor, assembler, linker, and debugger. After finishing this
More informationGDB Tutorial. Young W. Lim Tue. Young W. Lim GDB Tutorial Tue 1 / 32
GDB Tutorial Young W. Lim 2017-02-14 Tue Young W. Lim GDB Tutorial 2017-02-14 Tue 1 / 32 Outline 1 Introduction Young W. Lim GDB Tutorial 2017-02-14 Tue 2 / 32 Based on "Self-service Linux: Mastering the
More informationChapter 4 C Program Control
1 Chapter 4 C Program Control Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 2 Chapter 4 C Program Control Outline 4.1 Introduction 4.2 The Essentials of Repetition
More informationSimple C Program. Assembly Ouput. Using GCC to produce Assembly. Assembly produced by GCC is easy to recognize:
Simple C Program Helloworld.c Programming and Debugging Assembly under Linux slides by Alexandre Denault int main(int argc, char *argv[]) { } printf("hello World"); Programming and Debugging Assembly under
More informationPROGRAMMAZIONE I A.A. 2017/2018
PROGRAMMAZIONE I A.A. 2017/2018 STEPS OF GCC STEPS file.c Preprocessor Compiler file1.o file2.o Assembler Linker executable file PREPROCESSOR PREPROCESSOR The C preprocessor is a macro processor that is
More informationCSE 374 Programming Concepts & Tools
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2017 Lecture 11 gdb and Debugging 1 Administrivia HW4 out now, due next Thursday, Oct. 26, 11 pm: C code and libraries. Some tools: gdb (debugger)
More informationDebugging. John Lockman Texas Advanced Computing Center
Debugging John Lockman Texas Advanced Computing Center Debugging Outline GDB Basic use Attaching to a running job DDT Identify MPI problems using Message Queues Catch memory errors PTP For the extremely
More informationReviewing gcc, make, gdb, and Linux Editors 1
Reviewing gcc, make, gdb, and Linux Editors 1 Colin Gordon csgordon@cs.washington.edu University of Washington CSE333 Section 1, 3/31/11 1 Lots of material borrowed from 351/303 slides Colin Gordon (University
More informationUsing the GNU Debugger
Using the GNU Debugger 6.828 Fall 2014 September 10, 2014 6.828 Fall 2014 Using the GNU Debugger September 10, 2014 1 / 14 Homework solution From bootasm.s: # Set up the stack pointer and call into C.
More informationCMPT 300. Operating Systems. Brief Intro to UNIX and C
CMPT 300 Operating Systems Brief Intro to UNIX and C Outline Welcome Review Questions UNIX basics and Vi editor Using SSH to remote access Lab2(4214) Compiling a C Program Makefile Basic C/C++ programming
More informationGDB Tutorial. University of Waterloo
GDB Tutorial University of Waterloo Version 1.0 Caroline Kierstead and Peter A. Buhr c 2002 April 1, 2002 Permission is granted to make copies for personal or educational use 2 GDB Tutorial Contents 1
More informationDay05 A. Young W. Lim Sat. Young W. Lim Day05 A Sat 1 / 14
Day05 A Young W. Lim 2017-10-07 Sat Young W. Lim Day05 A 2017-10-07 Sat 1 / 14 Outline 1 Based on 2 Structured Programming (2) Conditions and Loops Conditional Statements Loop Statements Type Cast Young
More informationUsing the GNU Debugger
Using the GNU Debugger 6.828 Fall 2016 September 14, 2016 6.828 Fall 2016 Using the GNU Debugger September 14, 2016 1 / 14 Homework solution 6.828 Fall 2016 Using the GNU Debugger September 14, 2016 2
More informationgdbtui - Linux Command
tui tui - Linux Command -batch -cd= dir -f -b bps -tty= dev -s sym -e prog -se prog -c core cmds -d dir prog core procid]] SYNOPSIS -help-nx-q DESCRIPTION The purpose of a debugger such as GDB is to allow
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationGeneral Debugging Strategies
An Interactive Guide to Faster, Less Frustrating Debugging Adapted from http://heather.cs.ucdavis.edu/~matloff/unixandc/clanguage/debug.html by Norman Matloff Contents: Introduction General Debugging Strategies
More informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to
More informationDeitel Dive-Into Series: Dive-Into Cygwin and GNU C++
1 Deitel Dive-Into Series: Dive-Into Cygwin and GNU C++ Objectives To be able to use Cygwin, a UNIX simulator. To be able to use a text editor to create C++ source files To be able to use GCC to compile
More informationPrinceton University COS 217: Introduction to Programming Systems GDB Tutorial and Reference
Princeton University COS 217: Introduction to Programming Systems GDB Tutorial and Reference Part 1: Tutorial This tutorial describes how to use a minimal subset of the gdb debugger. For more information
More informationDay06 A. Young W. Lim Wed. Young W. Lim Day06 A Wed 1 / 26
Day06 A Young W. Lim 2017-09-20 Wed Young W. Lim Day06 A 2017-09-20 Wed 1 / 26 Outline 1 Based on 2 C Program Control Overview for, while, do... while break and continue Relational and Logical Operators
More informationC: Program Structure. Department of Computer Science College of Engineering Boise State University. September 11, /13
Department of Computer Science College of Engineering Boise State University September 11, 2017 1/13 Scope Variables and functions are visible from the point they are defined until the end of the source
More informationStructured Program Development
Structured Program Development Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Introduction The selection statement if if.else switch The
More informationBasic functions of a debugger
UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS61B Spring 1998 P. N. Hilfinger Simple Use of GDB A debugger is a program that runs other
More informationIntro to MS Visual C++ Debugging
Intro to MS Visual C++ Debugging 1 Debugger Definition A program used to control the execution of another program for diagnostic purposes. Debugger Features / Operations Single-Stepping 100011101010101010
More informationCompilation, Disassembly, and Profiling (in Linux)
Compilation, Disassembly, and Profiling (in Linux) CS 485: Systems Programming Spring 2016 Instructor: Neil Moore 1 Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc O1 p1.c
More informationDebugging with GDB and DDT
Debugging with GDB and DDT Ramses van Zon SciNet HPC Consortium University of Toronto June 13, 2014 1/41 Ontario HPC Summerschool 2014 Central Edition: Toronto Outline Debugging Basics Debugging with the
More informationSupplement: Visual C++ Debugging
Supplement: Visual C++ Debugging For Introduction to C++ Programming By Y. Daniel Liang Note: The screen shots are taken from VC++ 2010. It is the same for the later version. 1 Introduction The debugger
More informationSGI Altix Getting Correct Code Reiner Vogelsang SGI GmbH
SGI Altix Getting Correct Code Reiner Vogelsang SGI GmbH reiner@sgi.com Module Objectives After completing the module, you will able to Find caveats and hidden errors in application codes Handle debuggers
More informationJackson State University Department of Computer Science CSC / Advanced Information Security Spring 2013 Lab Project # 5
Jackson State University Department of Computer Science CSC 439-01/539-02 Advanced Information Security Spring 2013 Lab Project # 5 Use of GNU Debugger (GDB) for Reverse Engineering of C Programs in a
More informationMigrating from Inspect to Native Inspect
Revised for H06.08 Seth Hawthorne NonStop Enterprise Division Hewlett-Packard Company Introduction Native Inspect is the standard command-line debugger for debugging natively compiled programs on HP Integrity
More informationReview of Scientific Programming in C and Fortran. Michael McLennan Software Architect HUBzero Platform for Scientific Collaboration
Review of Scientific Programming in C and Fortran Michael McLennan Software Architect HUBzero Platform for Scientific Collaboration Monte Carlo Simulator Simulate by randomly generating thousands of tracks?
More informationCode Review and Debugging (Lab 05)
Code Review and Debugging (Lab 05) Assignment Overview The aim of this lab is: do a code review to learn the Google Code style rules learn to debug your C++ programs. The purpose of a debugger is to allow
More informationYou can also start with both an executable program and a core file specified:
NAME ddd, xddd - the data display debugger SYNOPSIS ddd [ gdb ][ dbx ][ xdb ][ jdb ][ pydb ][ perl ][ debugger name ][ [r]host [username@]hostname ]] [ help ][ trace ][ version ][ configuration ][options...
More informationProgram Control Structures
Program Control Structures Michael Griffiths Corporate Information and Computing Services The University of Sheffield Email m.griffiths@sheffield.ac.uk Control Sequence Structures Selection Structures
More informationSection 1: Tools. Kaifei Chen, Luca Zuccarini. January 23, Make Motivation How... 2
Kaifei Chen, Luca Zuccarini January 23, 2015 Contents 1 Make 2 1.1 Motivation............................................ 2 1.2 How................................................ 2 2 Git 2 2.1 Learn by
More informationDebugging. ICS312 Machine-Level and Systems Programming. Henri Casanova
Debugging ICS312 Machine-Level and Systems Programming Henri Casanova (henric@hawaii.edu) Debugging Even when written in high-level languages, programs have bugs Recall the thought that when moving away
More informationCS356: Discussion #5 Debugging with GDB. Marco Paolieri
CS356: Discussion #5 Debugging with GDB Marco Paolieri (paolieri@usc.edu) Schedule: Exams and Assignments Week 1: Binary Representation HW0. Week 2: Integer Operations Week 3: Floating-Point Operations
More informationProgramming in C week 1 meeting Tiina Niklander
Programming in C week 1 meeting 2.9.2015 Tiina Niklander Faculty of Science Department of Computer Science 3.9.2015 1 Course structure Based on C programming course in Aalto, but with some exercises created
More informationLAB #8. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:
LAB #8 Each lab will begin with a brief demonstration by the TAs for the core concepts examined in this lab. As such, this document will not serve to tell you everything the TAs will in the demo. It is
More informationCheckpointing using DMTCP, Condor, Matlab and FReD
Checkpointing using DMTCP, Condor, Matlab and FReD Gene Cooperman (presenting) High Performance Computing Laboratory College of Computer and Information Science Northeastern University, Boston gene@ccs.neu.edu
More informationPermission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on
GDB Annotations Edition 0.5 May 1994 Cygnus Support Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on
More information18-600: Recitation #3
18-600: Recitation #3 Bomb Lab & GDB Overview September 12th, 2017 1 Today X86-64 Overview Bomb Lab Introduction GDB Tutorial 2 3 x86-64: Register Conventions Arguments passed in registers: %rdi, %rsi,
More informationGDB cheatsheet - page 1
Running # gdb [core dump] Start GDB (with optional core dump). # gdb --args Start GDB and pass arguments # gdb --pid Start GDB and attach to process. set args
More informationC Program Development and Debugging under Unix SEEM 3460
C Program Development and Debugging under Unix SEEM 3460 1 C Basic Elements SEEM 3460 2 C - Basic Types Type (32 bit) Smallest Value Largest Value short int -32,768(-2 15 ) 32,767(2 15-1) unsigned short
More informationLAB 1 INTRODUCTION TO LINUX ENVIRONMENT AND C COMPILER
LAB 1 INTRODUCTION TO LINUX ENVIRONMENT AND C COMPILER School of Computer and Communication Engineering Universiti Malaysia Perlis 1 1. GETTING STARTED: 1.1 Steps to Create New Folder: 1.1.1 Click Places
More informationProgramming in C First meeting
Programming in C First meeting 8.9.2016 Tiina Niklander Faculty of Science Department of Computer Science www.cs.helsinki.fi 8.9.2016 1 Course structure Weekly exercise deadline on Wednesday, lectures
More informationYour code must have been compiled with the -g compiler option. Example:
ddd Tips This provides some helpful information about the Unix ddd debugger. with more detailed information: There are other resources available gnu ddd manual matloff ddd information Contents Prerequisites...
More informationChapter 4 C Program Control
Chapter C Program Control 1 Introduction 2 he Essentials of Repetition 3 Counter-Controlled Repetition he for Repetition Statement 5 he for Statement: Notes and Observations 6 Examples Using the for Statement
More informationThe CS-220 Development Environment
The Development Environment (No relevant sections in text) Picking the right tool for the job 2 Integrated Development Environment 3 Command Line Mentality Old fashioned but surprisingly efficient (except
More informationUsing a debugger. Segmentation fault? GDB to the rescue!
Using a debugger Segmentation fault? GDB to the rescue! But first... Let's talk about the quiz Let's talk about the previous homework assignment Let's talk about the current homework assignment K findkey(v
More information