0

I'm just working on find.c and helpers.c. My sort is not completely working yet and I'm trying to debug the program but the debugger is not working.

Is there anything special I have to do since find.c is calling helpers.c?

Right now I'm adding printf statements to see whats going on with my variables but it's really tedious!

Thanks for you help!

0

You are not supposed to change find.c.

Is find compiling? If so, you can debug the compiled programme like

./generate 1000 50 | debug50 ./find 127

(or any number you'd like to use). In helpers.c, using the IDE, you can set a breakpoint (click left of the line number where you want to enter the debugger's interactive mode), show variable contents, and proceed in the code line by line if you want.

I still did some printf debugging, as sometimes it is easier to dump an array than to view it in the debugger interface.

For example, I printed the content of the array before and after sorting (with a line "Before:" and "After:" above the values), and tested that for small arrays (<10 elements) to check for non-sorted parts or elements missing from the sorted version, for example from duplication of other elements.

| improve this answer | |
  • Thanks for the help! Yeah I didn't change find.c I just made the sort and search functions. I don't know what I did but I think I wrote something wrong when trying to run the debugger. The way you wrote it works! I printed the array already but I want to check why it's not putting everything in order! – Christopher W Sep 7 '17 at 1:21

You must log in to answer this question.

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