CSC161 2011S Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Reading: DDD Manual, Summary and Sample Session
Please submit a question by 9 p.m. on Sunday, 10 April 2011.
Do we have a DDD program in our linux computers?
Do we have a debugging console to use? Yes. I wouldn't have you read about it otherwise.
Why don't they comment their code?
I don't know.
The debugging code is like writing tiny unit tests within each code to see what each section does. Is that true?
Not really. Debugging lets you watch what it does. Unit tests are
supposed to either say it worked
or it did not work
.
How is DDD able to function the way it does?
We can tell the C compiler to insert information into the compiled code that lets the debugger know more about the program. The debugger can then use that knowledge to control execution and to show you the value of variables.
In...
=> a = (int *)malloc((argc - 1) * sizeof(int));
What is malloc?
A request to allocate memory. You saw something like that a bit earlier.
Will we ever use a debugger on our super simple C code?
I hope so.
Why didn't you show us this soooonerrrr?
Why have you not told us about this before?
The examples expect a certain level of knowledge. I also wanted you to have some experience thinking through code yourself. Last semester's students also said to wait until you had more complex things to debug.
Can you explain its execution in a little more detail?
No.
It seems like a person's success in using DDD largely depends on their skill with identifying where to set break points. Does DDD offer suggestions as to where to start with break point insertion, or is it left entirely up to the programmer?
It's entirely left up to the programmer.
Does the data window update itself as you go through the program, or would you have to use Display more than once?
It depends on which display command you use.
The reading seemed clear. I think I just need to try using DDD...
I would agree. That's why we'll have a lab.
I would like to see some more examples of how DDD is used.
We'll do a lab.
What does the -g flag while compiling actually do? How is it different from a program compiled without the flag?
It tells the compiler to leave in information for the debugger ... Here's
where I store this variable
; Here's the code for this line.
a And
son on and so forth.
What is an inferior debugger?
DDD is a graphical user interface to an underlying debugger. That
underlying debugger is called the inferior debugger
. It is not
inferior in the sense of not as good
.
Why do they have a different debugger for each programming language?
Because languages are understood in different ways and the compiler needs to know both the structure of the language and the structure of the compiled code.
When do we use this? (Do we use it when we know there is a bug or do we use it to test to see if there is a bug? Is there a way to make it automatically test many values or do we have to tell it which values to test?)
You will use it when you know there is a bug (e.g., because your unit tests suggest there is one and you need to track it down.
Can breakpoints be placed in the middle of a line?
I don't think so.
I understand everything in the reading, but I do no understand how this works with the values entered in the command line (when we use features like edit etc.)?
I don't understand the question.
This is really cool. So it's basically like having a controlled environment to run programs in? A bit like Dr. Scheme?
Yes.
When you correct your code through the debugger, does it actually change your code? Do you have to set special permissions to allow it to do this?
Yes, it will change your code. No, you don't have to set special permissions.
There's a lot to take in from this reading...What are the main ideas we need to know?
You'll learn as you use it.
Is there a way to only break conditionally? i.e. if you are in a loop from 1..500, and you think there may be an off by 1 error (or something similar that you want to look at the last few iterations), could you have it start breaking once your counter gets to 490?
There is, but I'll admit that I don't know it off the top of my head.
Is this always better than manual debugging?
I'm not sure what you mean by manual debugging
. I find it useful
to trace code by hand. I find it useful to put in printf
statements. But using a debugger is usually faster than either.
Does debugging slow down the program?
Yes.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Apr 11 10:45:25 2011.
The source to the document was last modified on Mon Apr 11 10:45:23 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Readings/debugging.html.