User Tools

Site Tools


notes:data:fall2022:projects:sll2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:data:fall2022:projects:sll2 [2022/10/01 00:59] – [BACKGROUND] dmucknotes:data:fall2022:projects:sll2 [2022/10/05 18:05] (current) – [Basic GDB] gsuber
Line 10: Line 10:
 </cli> </cli>
 remove the following line of code (after the line that says ''lib:'') remove the following line of code (after the line that says ''lib:'')
-<code+<cli
- @date +'%Y%m%d%H%M%S' >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/.metrics/${USER} +@date +'%Y%m%d%H%M%S' >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/.metrics/${USER} 
-</code>+</cli>
 Then try building the project again. Then try building the project again.
  
Line 25: Line 25:
 We have 5 tasks to do for full credit. These are: We have 5 tasks to do for full credit. These are:
   * clear() deallocates all nodes, returns an empty list   * clear() deallocates all nodes, returns an empty list
-  * obtain() contains a double pointer+  * obtain() contains a double pointer (should use getpos() and setpos() from previous sllX)
   * rm() should be making use of the clear()   * rm() should be making use of the clear()
   * sort() could be supported with swap, but is not necessary   * sort() could be supported with swap, but is not necessary
Line 31: Line 31:
  
  
-You also have an extra task, for extra credit, inside app/list/ of your sll2 base directory. The extra credit task is to build a linked list based on input from the user. You will also determine whether or not this linked list is a palindrome linked list or not. In case you don't know what a palindrome list is, here is an example. A palindrome list is a list that would look the same if you reversed it. For example, if you have a list, 1 2 3 2 1, that would be a palindrome, because if you display it backwards or forwards, it would display the same thing. +You also have an extra task, for extra credit (26 points), inside app/list/ of your sll2 base directory. The extra credit task is to build a linked list based on input from the user. You will also determine whether or not this linked list is a palindrome linked list or not. In case you don't know what a palindrome list is, here is an example. A palindrome list is a list that would look the same if you reversed it. For example, if you have a list, 1 2 3 2 1, that would be a palindrome, because if you display it backwards or forwards, it would display the same thing.  
 + 
 +The palindrome should accept values either from the CLI, stdin, or both. Be able to determine if the created list is a palindrome. Reverse the list(hint: use sortlist()). Finally, display the list.
  
 *Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project. *Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project.
Line 38: Line 40:
 =====PROGRAM===== =====PROGRAM=====
 Recommended Order to make functions:\\ Recommended Order to make functions:\\
-1. Obtain()\\  +  - obtain() 
-2. clearlist()\\  +  clearlist() 
-3. rmlist()\\ +  rmlist() 
-4. swap()\\ +  swap() 
-5. sort()\\ +  sort() 
 Details as to the behaviour of the functions can be found as comments inside the .c files of the programs themselves, located in src/list. If confusion arises in the make check process to verify then the .c code of the verify files can be found inside the unit/list directory. Do note that the verify code can rely upon some of the functions you are making to check the others, hence the recommended order. Details as to the behaviour of the functions can be found as comments inside the .c files of the programs themselves, located in src/list. If confusion arises in the make check process to verify then the .c code of the verify files can be found inside the unit/list directory. Do note that the verify code can rely upon some of the functions you are making to check the others, hence the recommended order.
 +
 +The unit tests for sll2 make use of several of the functions made in previous projects as well.  So if some of those other functions aren’t working as they should be, it could cause mismatches in the unit tests for sll2.  It may be helpful to run the unit tests individually to check the output of specific functions.
  
 Make sure to not overestimate what you are trying to do, especially in obtain(), do not try to optimize your program by removing the node, because the node will be held in the double pointer thatNode. Make sure to not overestimate what you are trying to do, especially in obtain(), do not try to optimize your program by removing the node, because the node will be held in the double pointer thatNode.
 +
 +If you have difficulty debugging **obtain()**, ensure //lead// and //last// pointers are being set appropriately: if you are obtaining the first node in the list update the lead pointer, if you are obtaining the last node in the list update the last pointer. Not doing so may cause an endless loop in **unit-obtain**.
 =====OUTPUT SPECIFICATIONS===== =====OUTPUT SPECIFICATIONS=====
  
 =====UNIT TESTS===== =====UNIT TESTS=====
  
 +=====Basic GDB=====
 +GDB is a very useful tool, especially if you are running into segmentation faults on any unit test. GDB allows you to set breakpoints, find the line of a segfault, display values of variables at a particular point in the program, and step line by line. Below are some common examples:
 +
 +To launch gdb (obtain used as example):
 +<cli>
 +USER@lab46:DIR/sll2/unit/list$ gdb unit-obtain
 +</cli>
 +
 +===Basic Operations===
 +
 +Placing a breakpoint at line #5:
 +<cli>
 +(gdb) b 5
 +</cli>
 +
 +Placing a breakpoint at function //main()//:
 +<cli>
 +(gdb) b main
 +</cli>
 +
 +Run program until next breakpoint:
 +<cli>
 +(gdb) r
 +**or**
 +(gdb) run
 +</cli>
 +
 +Continue after breakpoint is hit:
 +<cli>
 +(gdb) c
 +</cli>
 +
 +Display variable state:
 +<cli>
 +(gdb) print var
 +</cli>
 +
 +Execute one line (after breakpoint is hit):
 +<cli>
 +(gdb) n
 +</cli>
 +
 +Step into function:
 +<cli>
 +(gdb) s
 +</cli>
notes/data/fall2022/projects/sll2.1664585955.txt.gz · Last modified: 2022/10/01 00:59 by dmuck