======Part 1======
=====Entries=====
====Entry 1: September 5th, 2012====
Data:
* Reviewed Datatypes
* Started writing a datatype/size program.
* Using a variable uc (+ 1/- 1) did not make perfect sense (will review)
====Entry 2: September 5th, 2012====
Discrete:
* Reviewed Pointers
* Wrote a program to demonstrate understanding of basic Pointers.
* Printed data to show how a pointer interacts with the address of a variable.
====Entry 3: September 11th, 2012====
Discrete:
* Took a look at teacher's BigNum implementation.
* Worked on logic table program by implementing my own logically operator.
* Reviewed understanding of classes and including files into a main program file.
====Entry 4: September 14th, 2012====
Data:
* Learned about (Singly) Linked Lists.
* Implemented a test program with SLLs.
* Added an append functionality to the test program.
* Experimented with the start of a deletion functionality for SLL test program.
=====Keywords=====
{{page>datapart1&nofooter}}
{{page>datacommpart1&nofooter}}
{{page>discretepart1&nofooter}}
{{page>hpc1part1&nofooter}}
=====Experiment 1=====
====Question====
Is there a way to edit a line of code within a file while running the debugger GDB?
====Resources====
* http://web.eecs.umich.edu/~sugih/pointers/gdbQS.html
* http://www.cs.cmu.edu/~gilpin/tutorial/
* http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Companion/intro_talks/gdb/gdb.html
====Hypothesis====
Based on what I've read, I do not believe it is possible to edit a specific line of code in the file you are currently debugging but I do believe it is possible to change the value of a variable to help aid in changing the outcome of a line of code in your program.
My reasoning behind these assumptions are based on the pages I have read about how to use GDB efficiently to debug programs.
====Experiment====
To test my assumption, I will be editing a variable within a running program to change the outcome of a line of code, but I do know already there are no options to edit a file running with GDB.
====Data====
jpettie@lab46:~/src/data$ gcc pointers.c -o pointers -g
jpettie@lab46:~/src/data$ gdb ./pointers
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/jpettie/src/data/pointers...done.
(gdb) break 10
Breakpoint 1 at 0x40057f: file pointers.c, line 10.
(gdb) run
Starting program: /home/jpettie/src/data/pointers
a is located at 0xFFFFE1DC
b is located at 0xFFFFE1D0
Breakpoint 1, main () at pointers.c:10
10 printf("\n");
(gdb) print a
$1 = 12
(gdb) print b
$2 = (int *) 0x7fffffffe2c0
(gdb) set var a = 13
(gdb) print a
$3 = 13
====Analysis====
Based on the data collected:
* My assumption was correct, I could set the value of a variable in my program with GDB to change the output of a program.
* There is no more going on than I originally thought.
* The shortcomings in my experiment were trying to change a line of actual code from within GDB, I can only debug lines and change the way they are issued but not alter the actual file from inside the debugger.
====Conclusions====
From performing this experiment I have learned that I can change the value of a variable within my program and step backwards in order to find out if the value of a variable is causing an issue with the execution of my program. I would do this by the command "set var" in GDB.
(gdb) print a
$1 = 12
(gdb) set var a = 13
(gdb) print a
$2 = 13