0

I want to debug the program but no debug tab is there which is shown in pset3 video. Whats the problem. enter image description here

1

Google "cs50 gdb youtube" and you will find two helpful videos explaining how to use the debugger from the command line. It's much more reliable, and has the added benefit of being a tool that will always be available to you in the future even if you do not use the Cloud9 IDE for development.

Basically, to debug myprog with a breakpoint at myfunc, passing arguments arg1 and arg2, do the following:

gdb ./myprog
break myfunc
run arg1 arg2

After that, you can step forward with n, or step into a function with s. Use info args to view arguments, info locals to view local variables, and p foo to print the value of variable foo.

To debug functions in multiple files, set your breakpoints and then as you are stepping through statements with n, pay attention and when you get to the line that calls the externally-defined function, step into it with s instead.

1

The lastest version of the IDE has a new debug50 utility.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .