17/02/2016S. Ponce / EP-LBC1 Debugging Under Linux Sebastien Ponce Friday, 8 March 2002.

Slides:



Advertisements
Similar presentations
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER TotalView on the T3E and IBM SP Systems NERSC User Services June 12, 2000.
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
Ten debugging techniques. The execution process Execution proceeds in a standard series of steps Compute values of subexpressions first Then call value.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
CSE 303 Lecture 13a Debugging C programs
CIT 590 Debugging. Find a laptop Please take a moment to open up your laptop and open up Eclipse. If you do not have a laptop, please find a friend. If.
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
C Slides and captured lecture (video and sound) are available at:
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
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.
Homework Reading Programming Assignments
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.
CSE 332: C++ debugging in Eclipse C++ Debugging in Eclipse We’ve now covered several key program features –Variable declarations, expressions and statements.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Active-HDL Interfaces Debugging C Code Course 10.
9/2/ CS171 -Math & Computer Science Department at Emory University.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
Debugging and Profiling With some help from Software Carpentry resources.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
CSE 332: C++ debugging Why Debug a Program? When your program crashes –Finding out where it crashed –Examining program memory at that point When a bug.
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.
1 SEEM3460 Tutorial Compiling and Debugging C programs.
Data Display Debugger (DDD)
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
Georgia Institute of Technology Creating Classes part 2 Barb Ericson Georgia Institute of Technology June 2006.
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.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Intro to SPIM Justin Fiore Nathan Parish. Installing SPIM on Windows Download pcspim.zip from the SPIM website:
Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did.
CSI605 Introduction to ddd. ddd ddd stands for the Data Display Debugger ddd is a graphical environment that resides on top of gdb We recall that gdb.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Debug in Visual Studio Windows Development Fundamentals LESSON 2.5A.
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
CSE 332: C++ debugging in Eclipse C++ Debugging in Eclipse We’ve looked at programs from a text-based mode –Shell commands and command lines –Text editors,
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
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.
CSE 332: C++ expressions Expressions: Operators and Operands Operators obey arity, associativity, and precedence int result = 2 * 3 + 5; // assigns 11.
1 Advanced.Net Debugging Using Visual Studio, R# and OzCode IT Week, Summer 2015.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
1 Using an Integrated Development Environment. Integrated Development Environments An Integrated Development Environment, or IDE, permits you to edit,
Hank Childs, University of Oregon April 13 th, 2016 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / /
CSE 332: Scientific debugging in C++ Scientific Debugging in C++ (with Eclipse & gdb) By now we’ve covered several key C++ features –Variable declarations.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Institute of Radio Physics and Electronics ILug-Cal Introduction to GDB Institute of Radio Physics and Electronics and Indian GNU/Linux Users Group Kolkata.
DEBUG.
Debugging with Clion and GDB
Eclipse Navigation & Usage.
Debugging with gdb gdb is the GNU debugger on our CS machines.
Computer Programming I
gdb gdb is the GNU debugger on our CS machines.
Barb Ericson Georgia Institute of Technology Dec 2009
Quick Start Guide for Visual Studio 2010
Computer Architecture “Bomb Lab Hints”
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science
When your program crashes
Testing, debugging, and using support libraries
Debugging Visual Basic Programs
CISC 361 Operating Systems Midterm Review
Debugging.
Hello World Program In Visual Studio and Debugging
Presentation transcript:

17/02/2016S. Ponce / EP-LBC1 Debugging Under Linux Sebastien Ponce Friday, 8 March 2002

08/03/2002S. Ponce / EP-LBC2 Overview  When to use a debugger ?  Available debuggers  Very short introduction to gvd (GNU Visual Debugger)  Some hints on debugging Gaudi Jobs  Demo

08/03/2002S. Ponce / EP-LBC3 When to Use a Debugger ?  If you compiled in debug mode : When you want to trace an application execution (breakpoints, step in,...)When you want to trace an application execution (breakpoints, step in,...) When you want to know where the execution crashes (segmentation fault is handled)When you want to know where the execution crashes (segmentation fault is handled)  If you compiled in optimize mode : You can still know which functions were called and which one failedYou can still know which functions were called and which one failed

08/03/2002S. Ponce / EP-LBC4 What to Do With a Core ?  You can still debug a program after a segmentation fault if you have a core file  You can learn about Where it failed Where it failed What were the values of variables at this time What were the values of variables at this time What was the call stack at this time What was the call stack at this time

08/03/2002S. Ponce / EP-LBC5 Available Debuggers  GDB  Default linux debugger  Powerfull & stable  Installed on lxplus  BUT for experts only  DDD  Based on gdb  Installed on lxplus  Allow Visual debugging  BUT not stable  GVD  Based on gdb  Installed in LHCb  Allow visual debug  Stable  Can be found for free at  Very easy to install locally PREFERED CHOICE

08/03/2002S. Ponce / EP-LBC6 Launching gvd  Launching gvd : source setup.csh gvd  Inside gvd : [set breaking points] run  In case of core dump : source setup.csh gvd  Inside gvd : File  Open Core Dump

08/03/2002S. Ponce / EP-LBC7 gvd Basics gvd Basics Menu bar Tool bar Call stack Source files Gdb window Data display Current Line Source code

08/03/2002S. Ponce / EP-LBC8 Some Hints for Gaudi Jobs  Gaudi is using shared libraries  The source files of these do no appear in gvd before the libraries are loaded  The trick is : gvd gvd break main run run next  here we loaded the ApplicationMgr break ApplicationMgr::configure cont finish  now every dll is loaded

08/03/2002S. Ponce / EP-LBC9 Demo (1)  Launch : tar xvf demo.tar cd demo make./hello Segmentation Fault gvd hello

08/03/2002S. Ponce / EP-LBC10 Demo (2)  gdb windows : (gdb) run Starting Program: /home/sponce/demo/hello Program received signal SIGSEGV, Segmentation fault 0x400e1630 in strcmp() from /lib/libc.so.6 (gdb)  In menu Data  Call Stack  In Tool Bar Up

08/03/2002S. Ponce / EP-LBC11 Demo (3) argument line was 0x0 strcmp called from Hello::print Click "Up" once more to see where the line argument was set to 0x0

08/03/2002S. Ponce / EP-LBC12 Demo (4) Hello::print called from Hello::displayMessage with no argument when print argument is missing, the default is a 0 pointer and fails. The default has to be changed to empty string

08/03/2002S. Ponce / EP-LBC13 Demo (5)  Edition of Hello.h : static void print (char* line = 0); becomes : static void print (char* line = "");  In a shell : make./hello Segmentation Fault gvd hello  In gvd run There is another bug !

08/03/2002S. Ponce / EP-LBC14 Demo (6)  In gvd : display Call Stack “Up"  The bug is still in strcmp, line is still 0x0  In gvd : “Up" Data  Display Any Expression  ”this” Then click on the fields of this to see the internal values

08/03/2002S. Ponce / EP-LBC15 Demo (7) this  m_message is 0x0 We'll try to place a breakpoint where the initialization of m_message is done, i.e. In the constructor of Hello.

08/03/2002S. Ponce / EP-LBC16 Demo (8)  In gvd : Click on the blue point in front of line 4 of Hello.cpp to set a break point there Click run Say you want to start from beginning  gvd stops when the program reaches line 4 obviously the constructor was called with message = 0x0 Click "Up" to see where we came from

08/03/2002S. Ponce / EP-LBC17 Demo (9) We were suppose to go through line 20, not 22 since we gave no argument This should have been 1 == argc !!! Fix and run. All Right !

08/03/2002S. Ponce / EP-LBC18 Demo (10) This is an example of what you get in case of non debug mode You still have the call stack but not the values of the arguments

08/03/2002S. Ponce / EP-LBC19 Demo (11) This show you what you get from a core : gvd hello File->Open Core It’s equivalent to run the program inside the debugger