3
votes
Accepted
How do you pass arguments into GDB argv[1] argv[2]?
To run GDB with arguments in the terminal, use the --args parameter.
gdb --args name arg1 arg2 arg3
debug50 (the graphical debugger) is just GDB with a GUI. GDB was originally designed to be run ...
2
votes
Accepted
Check function skipping the check and returning all words as misspelled
print thisNode->word
$2 = "elephant\n"
Looks like you are including the new line char in your word. This will cause all of the words to be misspelled, as the word sent to check will, of course, ...
2
votes
Accepted
pset 3 GDB: "no executable file specified"
To debug "find" with gdb, enter the following command:
gdb find
You need to enter the filename of the executable as a parameter following gdb on the command line. Don't use ./ or .c when you enter ...
2
votes
Accepted
<value optimized> GDB self optimizing everything
"This is a bug in clang, which has been fixed in version 3.5. The CS50 team is working on getting an update out with update50." -see link
Variable optimized out eventhough it will be used later
2
votes
Accepted
Debugging a program using command line arguments
See the image below:
Note the command window. After I ran "Debug" once, I had to add the command-line argument "bacon" in order to get vigenere to run. I can simply edit the command box with any ...
1
vote
How to view global variable state in GDB?
Type the variable name in the Watch Expressions section at the top.
1
vote
Accepted
GDB "No such file or directory" error
What does it say in the new terminal window after "Runner:"? I suspect it says "Shell Command" or "Auto". A ".c" file cannot run in the shell. Has it been a while since you tried this? There used to ...
1
vote
Accepted
Pset6 - Error With Using GDB
We have a serious problem at the very beginning.
char* method_str = "";
I guess you want to write a blank, so write it for real. The lack of white space can cause segfault, or a strange behavior of ...
1
vote
Accepted
Pset6 - Help testing in gdb
Nevermind. I figured it out by rereading the course material and an answer to a previous question. Here is how:
1) type "gdb ./server" in your terminal window.
2) type "break parse" a the (gdb) ...
1
vote
Pset6: How to debug load() and indexes()?
Here's what I do. Use debug50 instead of the command line gdb. If you haven't used that before:
Run update50 to be sure you are up to date (the IDE is on version 81 at the moment). Then, here's ...
1
vote
how to pass command line arguements in gdb
I couldn't get the hang of the ide50 debugger either.
Launch gdb like:
gdb whodunit
Then to run:
r file1.bmp file2.bmp
In case you have more gdb related questions in the future, I use this site, ...
1
vote
Accepted
pset6 parse: char* pointers are right in parse but return wrong value
Notice the difference between the declaration of abs_path/query in main
char abs_path[LimitRequestLine + 1];
char query[LimitRequestLine + 1];
vs. the declaration in parse.
bool parse(const char* ...
1
vote
Accepted
How to pipe PRNg into find.c debug GUI?
I don't think anyone has figured that one out. It may not be possible, but I would be happy for someone to prove me wrong.
OTOH, why do you want to work with so much input data in the debugger? ...
1
vote
How to use GDB at not main program?
For my example, "mainP.c" will be our main program, and "secondP.c" will be your secondary file. I am assuming your "mainP" calls "secondP" at some time during the execution of the program.
This is ...
1
vote
Accepted
pset4 resize segmentation fault
The problem is here:
if (isalpha(argv[1]))
isalpha() takes a single char as input. argv[1] is a string. When you try to stuff a string into isalpha(), it chokes and seg faults.
If this answers ...
1
vote
Accepted
PSET5 - CHECK returning... nothing?
At the bottom of your code, there is a place where your function will not return anything. That's probably around line 93 in your program, the line that clang complained about.
Now you need to follow ...
1
vote
killing all inferior GDB Get's stuck
If you have been using breakpoints, and you don't want to continue using the same breakpoint use the command delete and all of your breakpoints will be deleted. If you only want to delete 1 breakpoint,...
1
vote
Accepted
gdb piping not working
If your program is called find do the following.
make find
gdb find
break main
run 65516 < testNumbers10000.txt
next
1
vote
GDB: run a for loop x number of times
You can also use continue <n> to break only the Nth time the current breakpoint is hit, see also: https://stackoverflow.com/questions/2956889/how-to-make-a-gdb-breakpoint-only-break-after-the-...
1
vote
GDB: run a for loop x number of times
You can put a counter in the loop and set a breakpoint based on the counter. For example, say you had this program:
#includes go here ;-)
int main(int argc, string argv[])
{
for (int i=0; i<...
1
vote
Determining location of file pointer in ascending bytes with GDB
since you've already assigned a variable to each of your pointers, you can print out their values at any time in gdb via:
p in
p out
(p is shorthand for print)
Only top scored, non community-wiki answers of a minimum length are eligible