Hot answers tagged

4 votes

Debug50 is not functioning properly

I got the answer from someone named @Teapot on discord. Going to the top left of the ide at "CS50 IDE" and clicking "Reset Settings" did the trick for me. I was afraid this would ...
  • 81
3 votes
Accepted

Program and debug50 different results

Declaring the array here int matrix[candidate_count]; allocates the memory for it. But it does not initialize the contents. At the end of the for loop, there is a good chance that matrix[m] has not ...
2 votes

Do YOU know how to find a seg fault?? Advice to new programmers

Reread the post again, he explains why the seg fault happens. A quick google should suffice too.
  • 23
2 votes

Can't run debugger

I believe you're using VS Code locally, right? I had no problem using the codespace in the browser, but when I used it in my locally installed VS Code, there was this problem with debug50 in codes ...
1 vote
Accepted

speller seg fault

It's a common problem. ;-) Look carefully at the unload() code. In particular, this line: while(cursor -> next != NULL) Now, what happens if cursor itself is null? cursor->next doesn't ...
  • 64.6k
1 vote

Which code/command should I use in the IDE terminal to get suggestions of where I have made an error

Yes, just came to know the command. It will be: help50 make hello That is, help50 and add the command on which you are seeking help (which is 'make hello' for this example).
1 vote
Accepted

Pset2 Substitution My code working when I use debugger and does not working thorough console or test. What am I doing wrong?

Sometimes, an error or unpredictable condition can be masked or hidden by the debugger when you run the code in the debugger. This is the case here. I cannot tell you why it is failing, only that it ...
  • 64.6k
1 vote

Debug50 is not functioning properly

You can possibly restart the IDE from the top left, and click CS50 IDE, then restart. That fixes a lot of problems, and it may fix this!
  • 11
1 vote

Do YOU know how to find a seg fault?? Advice to new programmers

I found this post after I had asked about my segfault, and still appreciate the post. Luckily I had already debugged and found where the segfault is coming from. The problem I have now is that I don't ...
  • 11
1 vote

Do YOU know how to find a seg fault?? Advice to new programmers

A better way to identify the source of segmentation faults is to compile with -g -fsanitize=undefined -fsanitize=address running the program should then point you to the exact line where the ...
1 vote
Accepted

PSET3 Resize (Less) - works in debug50 but segmentation error when executing

You have just learned an important lesson. Seg faults can be muted by debug environments. When this happens, you need to isolate the offending statement using printf statements to see how far ...
  • 64.6k
1 vote

How to exit debug50 window?

Hit ctrl-c to stop your program.
  • 18.4k
1 vote
Accepted

./generate 1000 | ./find 42 failed, get_int() got nothing but program still worked

What you are seeing is exactly what I'd expect, except that there should be a final line that says it either found or didn't find 42 in the haystack. Perhaps you didn't include that in your post? ...
  • 18.4k
1 vote
Accepted

Does IDE50 offer an an "Immediate" window or the ability to use breakpoints/watches?

debug50 is the right tool. To set a breakpoint in your source (before running debug50), click in the gutter to the left of the line number and a 🔴 will appear.
1 vote

How to initiate debug50 when a variable reaches a certain value?

I found it. On the code editor in C9, right click and click "add conditional breakpoint" or click the line number to create a breakpoint and right click to set a condition for it. It will prompt for ...

Only top scored, non community-wiki answers of a minimum length are eligible