New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Programming In C

by: Nick Rowe

Programming In C CS 24000

Nick Rowe
GPA 3.68


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 13 page Class Notes was uploaded by Nick Rowe on Saturday September 19, 2015. The Class Notes belongs to CS 24000 at Purdue University taught by Rodriguez-Rivera in Fall. Since its upload, it has received 67 views. For similar materials see /class/208070/cs-24000-purdue-university in ComputerScienence at Purdue University.

Similar to CS 24000 at Purdue

Popular in ComputerScienence


Reviews for Programming In C


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15
u due University What is gdb I GDB is a debugger that helps you debug your program I The time you spend now learning gdb will save you days of debugging time I A debugger will make a good programmer a better programmer Compiling a program for gdb I You need to compile with the g option to be able to debug a program with gdb I The g option adds debugging information to your program gcc g 0 hello helloc Running a Program with gdb I To run a program with gdb type gdb progname gdb I Then set a breakpoint in the main function gdb break main I A breakpoint is a marker in your program that will make the program stop and return control back to gdb I Now run your program gdb run I If your program has arguments you can pass them after run Stepping Through your Program I Your program will start running and when it reaches main it will stop gdbgt I Now you have the following commands to run your program step by step gdb step ltwill run the next line of code and stop If it is a function call it will enter into it gdb next ltwill run the next line of code and stop If it is a function call it will not enterthe function and it will go through it Example gdb step gdb next Setting breakpoints I You can set breakpoints in a program in multiple ways gdb break function Set a breakpoint in a function Eg gdb break main gdb break line Set a break point at a line in the current file Eg gdb break 66 It will set a break point in line 66 of the current file gdb break file line twi set a break point at a line in a specific file Eg gdb break helloc78 Regaining the Control I When you type gdb run the program will start running and it will stop at a break point I Ifthe program is running without stopping you can regain control again typing ctrIc Where is your Program I The command gdb Where Will print the current function being executed and the chain of functions that are calling that fuction This is also called the backtrace Example gdb where 0 main at testmystringc22 gdb Printing the Value of a Variable I The command gdb print var Prints the value of a variable Eg gdb print i 1 5 gdb print 1 1 Ox10740 quotHelloquot gdb print stack2 1 56 gdb print stack 2 0 o 56 o o o o o o 0 gdb J Exiting gdb I The command quit exits gdb gdb quit The program is running anyway y or n y Exit Debugging a Crashed Program I This is also called postmortem debugging I It has nothing to do with CSI I When a program crashes it writes a core file bash 41 hello Segmentation Fault core dumped bash 41 I The core is a file that contains a snapshot of the program at the time of the crash That includes what function the program was running Debugging a Crashed Program I To run gdb in a crashed program type gdb program core Eg bash 41 gdb hello core GNU gdb 66 Program terminated with signal 11 Segmentation fault 0 0x000106cc in main at helloc11 11 52 9 gdb Now you can type where to find out where the program crashed and the value of the variables at the time of the crash gdb where 0 0x000106cc in main at helloc11 gdb print 52 1 0x0 gdb o This tells you why your program crashed Isn t that great Now Try gdb in Your Own Program I Make sure that your program is compiled with the g option I Remember 39One hour you spend learning gdb will save you days of debugging 3 Less stress better grades


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.