S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

Utilizing the GDB debugger to analyze programs Background and application.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
ECE Application Programming
Gdb: GNU Debugger Lecturer: Prof. Andrzej (AJ) Bieszczad Phone: “UNIX for Programmers and Users” Third Edition, Prentice-Hall,
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Guidelines for working with Microsoft Visual Studio.Net.
Sparc Architecture Overview
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
ClearSpeed Programming Language C n. References Primary Reference: ClearSpeed Introductory Programming Manual, Version 3.0, January 2008 Additional References:
OllyDbg Debuger.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Debugger Presented by 李明璋 2012/05/08. The Definition of Bug –Part of the code which would result in an error, fault or malfunctioning of the program.
Embedded Systems Principle of Debugger. Reference Materials kl.de/avr_projects/arm_projects/#winarmhttp://
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
Debugging Cluster Programs using symbolic debuggers.
Memory & Storage Architecture Seoul National University GDB commands Hyeon-gyu School of Computer Science and Engineering.
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
1 ENERGY 211 / CME 211 Lecture 13 October 20, 2008.
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.
Goals: To gain an understanding of assembly To get your hands dirty in GDB.
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.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Proposed Debugger Features Ken Ryall Warren Paul.
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.
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.
Debugging. Outline Announcements: –HW II due Fridayl db.
C++ crash course Class 9 flight times program, using gdb.
Review 1 List Data Structure List operations List Implementation Array Linked List.
Agenda Perform Quiz #1 (20 minutes) Loops –Introduction / Purpose –while loops Structure / Examples involving a while loop –do/while loops Structure /
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.
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.
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?
Tarik Booker CS 242. What we will cover…  Functions  Function Syntax  Local Variables  Global Variables  The Scope of Variables  Making Functions.
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
 Wind River Systems, Inc Chapter - 4 CrossWind.
GDB Introduction And Lab 2
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
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.
Computer System Laboratory
Winter 2009 Tutorial #6 Arrays Part 2, Structures, Debugger
ECE Application Programming
Dynamic Analysis ddaa.
Debugging with gdb gdb is the GNU debugger on our CS machines.
ClearSpeed Programming Language Cn
gdb gdb is the GNU debugger on our CS machines.
COMP 2710 Software Construction Introduction to GDB
Computer Architecture “Bomb Lab Hints”
Debugging with Eclipse
Debuggers.
Debugging at Scale.
GNU DEBUGGER TOOL. What is the GDB ? GNU Debugger It Works for several languages – including C/C++ [Assembly, Fortran,Go,Objective-C,Pascal]
Our Environment We will exercise on Microsoft Visual C++ v.6
Homework Reading Programming Assignments Finish K&R Chapter 1
Debugging.
Makefiles, GDB, Valgrind
Debugging with Eclipse
Computer Architecture and System Programming Laboratory
By Hugues Leger / Intro to GDB debugger By Hugues Leger / 11/16/2019.
Presentation transcript:

S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar

cscn –o mandelbrot.csx –g mandelbrotcp.cn --to compile program with debug support. csgdb mandelbrot.csx -- to Start debugging A message is displayed along with the current location of the program counter. List To view the program source. -> list -> set listsize 10

break 22 --to set a new break point -> break main -- to set a break around a function -> break info --to get info around all break points that have been set -> tbreak Gets deleted once hit by execution

run -- start running the program till the break point is reached. print (mono or poly) To view the state of all variables when the break point is reached. -> print /d --to print integer value of the variable -->set print elements Where Find the current location of the program counter while debugging. Whatis gives the data type of the variable name used delete

Next -- take the program counter to the next line of execution continue Run till the end of the program is reached. Step Differs from next because it steps into function call rather than stepping over.

Print &x print the address of variable x If address is $8p4 then print/f $8p4 Will give the value of x print/f $8p4[5] If x is poly then the above content will print the content of the 5 th register.

(gdb)step calcres (x=-1.5, y= {-1.25, , , , , , , , , , , , ……….},res=64) at mandelbrot.cn:52 52 xcal=x; Stop at the first valid line of code for the function calcres which is line number 52.

To limit the number of display of PE’s (gdb) set print elements 4 (gdb) where #0 calcres (x=-1.5, y={-1.25, , , }, res=64) at mandelbrot.cn:52 #1 0x800155a0 in main () at mandelbrot.cn:113

regs and peregs: The whole mono and poly register set can be viewed using the two above commands. Step: progress the debugger to the function up: To move up the call stack and back to main use the up command.

print/x $pc Print the program counter (PC) at the current location down Move back down the call stack into function using the down command p/x $enable To view the enable state of the poly array

Viewing the poly enable state Print the value of the enable register in the debugger: (gdb) p/x $enable $2 = {0xff } (gdb)p/t $enable Print the value of the enable state in binary }. This show that all 96 of the PEs are currently enabled at every level. --{ }.PEs are currently disabled:

Attaching a command to a breakpoint commands 4 Attaching a command to a breakpoint (gdb) commands 4 Type commands for when breakpoint 4 is hit, one per line. End with a line saying just "end". >print/t $enable >end (gdb) commands 5 Type commands for when breakpoint 5 is hit, one per line. End with a line saying just "end". >print/t $enable >end

 (gdb) info break  Num Type Disp Enb Address What  1 breakpoint keep y 0x in main at mandelbrot.cn:96  breakpoint already hit 1 time  4 breakpoint keep y 0x800150ec in terminate at  mandelbrot.cn:34  breakpoint already hit 1 time  print/t $enable  5 breakpoint keep y 0x in terminate at  mandelbrot.cn:36  breakpoint already hit 1 time  print/t $enable

Finish debugger can return from a function by using the finish command ignore 6 20 Will ignore next 20 crossings of breakpoint 6.

Viewing memory List 2 integers at the current PC location in mono memory using the x command: (gdb) x/2x $pc 0x800155f0 : 0x x (gdb) The argument “2” determines the number of values to print and the “x” specifies that the output is hexadecimal. pex/2x 0x0  pex/2x 0x  pex/4x &buffer

 Enter the same pex command again but add the argument to the end.  (gdb) pex/2x 0x  (PE 0) 0x0 : 0xdead2222 0x  (PE 1) 0x0 : 0xdead2222 0x  (PE 2) 0x0 : 0xdead2222 0x  (PE 3) 0x0 : 0xdead2222 0x  (PE 4) 0x0 : 0xdead2222 0x  (PE 5) 0x0 : 0xdead2222 0x  (PE 6) 0x0 : 0xdead2222 0x  (PE 7) 0x0 : 0xdead2222 0x  (PE 8) 0x0 : 0xdead2222 0x  (PE 9) 0x0 : 0xdead2222 0x  (PE 10) 0x0 : 0xdead2222 0x  (gdb)  You can now see 2 integer values for each of the first 11 processing elements.