1 15-441, Spring 2005 Debugging with gdb ???mber ??, 200? class03.ppt 15-441 David I. Murray 15-441, Fall 2005.

Slides:



Advertisements
Similar presentations
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 7, 2012 CSCE 212Honors Computer Organization.
Advertisements

Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
Tutorial 6 & 7 Symbol Table
Cse322, Programming Languages and Compilers 1 6/18/2015 Lecture #16, May 24, 2007 Runtime.c Running the code debugging assembler division strings for println.
1 Lab Session-2 CSIT 121 Spring 2005 Debugging Tips NiMo’s Varying Rates Lab-2 Exercise.
CSE 303 Lecture 13a Debugging C programs
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
OllyDbg Debuger.
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.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Homework Reading Programming Assignments
Debugging Cluster Programs using symbolic debuggers.
Memory & Storage Architecture Seoul National University GDB commands Hyeon-gyu School of Computer Science and Engineering.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
Copyright © 2009 Techtronics'09 by GCECT 1 Presents, De Code C De Code C is a C Programming competition, which challenges the participants to solve problems.
Programming Tools gcc make utility Open Source code Static and Shared Libraries gdb Memory debugging tools.
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
Compiling & Debugging Quick tutorial. What is gcc? Gcc is the GNU Project C compiler A command-line program Gcc takes C source files as input Outputs.
Chapter 9: MuPAD Programming II Procedures MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Program Errors and Debugging Week 10, Thursday Lab.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Hacking Techniques & Intrusion Detection Ali Al-Shemery arabnix [at] gmail.
Debugging Visual Basic.NET Programs ► ► Use debugging tools ► ► Set breakpoints and correct mistakes. ► ► Use a Watch and Local window to examine variables.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
Debugging Xin Tong. GDB GNU Project debugger Allows you to see what is going on `inside' another program while it executes or crashed. (Faster than printing.
Debugging parallel programs. Breakpoint debugging Probably the most widely familiar method of debugging programs is breakpoint debugging. In this method,
1 SEEM3460 Tutorial Compiling and Debugging C programs.
CSE 351 GDB Introduction. Lab 1 Status? How is Lab 1 going? I’ll be available at the end of class to answer questions There are office hours later today.
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
Debugging Computer Networks Sep. 26, 2007 Seunghwan Hong.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
COP 3530 Spring2012 Data Structures & Algorithms Discussion Session Week 2.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
COP 3530 Spring 12 Discussion Session 1. Agenda 1.Introduction 2.Remote programming 3.Separate code 4.Compile -- g++,makefile 5.Debug -- gdb 6.Questions?
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
17/02/2016S. Ponce / EP-LBC1 Debugging Under Linux Sebastien Ponce Friday, 8 March 2002.
Ladebug Kernel Debugging Tutorial Bob Lidral. Introduction Kinds of kernel debugging How to use Ladebug for kernel debugging Not how to debug a kernel.
Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first.
CS252: Systems Programming Ninghui Li Based on Slides by Gustavo Rodriguez-Rivera Topic 2: Program Structure and Using GDB.
1 Advanced.Net Debugging Using Visual Studio, R# and OzCode IT Week, Summer 2015.
EXCEPTIONS. Catching exceptions Whenever a runtime error occurs, it create an exception object. The program stops running at this point and Python prints.
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
GDB Introduction And Lab 2
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Using the GNU Debugger (GDB)‏ Techzemplary Pvt.Ltd February 24 th 2008 Pranav Peshwe.
Institute of Radio Physics and Electronics ILug-Cal Introduction to GDB Institute of Radio Physics and Electronics and Indian GNU/Linux Users Group Kolkata.
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors Locate seg faults and bus errors Prepared by Dr. Spiegel.
DEBUG.
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors
C Programming Types & Dynamic memory & bits & others
Dynamic Analysis ddaa.
CSE 374 Programming Concepts & Tools
Debugging with gdb gdb is the GNU debugger on our CS machines.
Software Design and Development
Debugging CMSC 202.
Testing Key Revision Points.
gdb gdb is the GNU debugger on our CS machines.
Introduction to Intel x86-64 Assembly, Architecture, Applications, & Alliteration Xeno Kovah – 2014 xkovah at gmail.
Debuggers.
Common C Programming Errors, GDB Debugging
Debugging at Scale.
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science
GNU DEBUGGER TOOL. What is the GDB ? GNU Debugger It Works for several languages – including C/C++ [Assembly, Fortran,Go,Objective-C,Pascal]
Detecting Runtime Errors and Exiting from Nested Macros Gracefully
Homework Reading Programming Assignments Finish K&R Chapter 1
CSE 303 Concepts and Tools for Software Development
Debugging.
Presentation transcript:

, Spring 2005 Debugging with gdb ???mber ??, 200? class03.ppt David I. Murray , Fall 2005

, Spring 2005 Debugging with GDB Prepare program for debugging Compile with “ -g ” (keep full symbol table) Don’t use compiler optimization (“ -O ”, “ –O2 ”, …) Two main ways to run gdb On program directly gdb progname Once gdb is executing we can execute the program with: » run args » Can use shell-style redirection e.g. run /dev/null On a core (post-mortem) gdb progname core Useful for examining program state at the point of crash Extensive in-program documentation exists help (or help or help )

, Spring 2005 Controlling Your Program With GDB Stopping your program with breakpoints Program will run until it encounters a breakpoint To start running again: cont Break command format break foo.c:4 stops at the 4 th source line of foo.c break 16 stops at the 16 th source line of the current source file break main stops upon entry to the main() function Stop your program with SIGINT (CTRL-C) Useful if program hangs (sometimes) Stepping through your program step N command: steps through N source lines (default 1) next is like step but it treats function calls as a single line Hint: avoid writing mega-expressions Hard to step through foo(bar(tmp = baz(), tmp2 = baz2()))

, Spring 2005 Examining the State of Your Program backtrace ( bt for short) Shows stack trace (navigate procedures using up and down ) bt full prints out all available local variables as well print EXP Print the value of expression Can print out values in variables x/ ADDR Examine a memory region at ADDR Count is the number of items to display (default: 1) Format is a single letter code o(octal), x(hex), d(decimal), u(unsigned decimal), t(binary), f(float), a(address), i(instruction), c(char) and s(string) Size is the size of the items (single letter code) b(byte), h(halfword), w(word), g(giant, 8 bytes)

, Spring 2005 Tips for the past Find a partner that doesn’t procrastinate. Schedule a *daily* meeting time. DAILY. Do a couple hours of work each day. Even meeting 3 days a week for a few hours, my partner and I pulled multiple all-nighters. Avoid this by meeting daily. Your implementations for each project can be expected to be 5,000 lines of code, plus or minus a few thousand (ours were between 4,000-6,000 lines). Divide that by days and it’s not as daunting. START THE DAY YOU RECEIVE THE PROJECT. My personal impression from last year is that the majority of failed/mostly unsuccessful projects failed due to time-related pressure, not content/understanding material pressure If you have time to do it, you can do it well. If not…

, Spring 2005

1 More tips for the past If you want to work directly on windows, you can use MinGW or Cygwin, *BUT TEST ON UNIX* Most of the APIs you will use will have many functions that return -1 to indicate error. Unlike previous classes, you must be able to recover when appropriate, and handle these errors on a case-by- case basis. Make buffers for *each* of your clients; don’t process a command until you know you’ve received the entire thing.

, Spring 2005 Finally… These projects are about implementing specifications. Read the writeup at least twice before starting. PLAN on paper (even draw) BEFORE coding. PLAN, PLAN, PLAN. Then coding and debugging will be much easier, and you won’t have to delete hundreds of lines of useless code over and over again. Good luck!