User Tools

Site Tools


opus:fall2012:jpettie:part1

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

data Keyword 1

passing by reference (function parameter passing) [C++]

Definition

To use the address of a variable as a reference to some sort of data contained in the variable to send to some algorithmic function which can use the variable's data to perform some sort of action or solve a problem.

References

data Keyword - Pointers to Pointers Phase 2

Definition

As we all know, a pointer is a special variable that does not hold a specific value, but rather the address of a value (or another variable). In the case of a “pointers to pointers” relationship, a pointer is used not to point to the address of another value, but to the address of another pointer.

A pointer to a pointer is written in code as **(pointer1) = &pointer2; where *pointer2 points to the address of another value/variable.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Demonstration

#include <stdio.h>
#include <stdlib.h>
 
int main(){
        int a = 12;
        int *b;
        printf("\n");
        printf("a is located at 0x%X\n", &a);
        printf("b is located at 0x%X\n", &b);
        printf("\n");
        printf("b, when dereferenced, points to %d\n", *b);
        printf("b contains 0x%X\n", b);
        printf("\n");
        b = &a;
        printf("b, when referenced, points to %d\n", *b);
        printf("b contains 0x%X\n", b);
        printf("\n");
        return(0);
}

datacomm Keyword 1

asterisk

Definition

A programming language to communicate and execute the basic functions of telephony services.

datacomm Keyword 1 Phase 2

SIP - Session Initiation Protocol

Definition

SIP is a signalling protocol. I would guess that that means it is a certain method of having machines communicate. It is typically used for voice and video communication. SIP can be used for two-party (unicast) and multiparty (multicast).

You can modify IPs and ports, invite more people, and add/delete media streams.

SIP can take care of 5 things:

  • User Location - Figures out what system will be used for the call.
  • User Availability - Determining the availability of the user.
  • User Capabilities - Determining how the call will be made (voice, video, etc).
  • Session Setup - The making of the session, making the ringing happen.
  • Session Management - Transferring, terminating, and modifying the call.

At first I had no idea what SIP was all about and had difficulty understanding it. Now I have a pretty good understanding, I think. I'll probably ask about it next class to make sure I am right, but I feel like SIP is basically just a 'code' of how machines communicate. Just like how humans use English, or Spanish, or Arabic. Computers can use SIP.

On further research, the analogy is fairly sound, but needs a little bit more to it. SIP is basically a specific format that machines can use to communicate. It's a set of certain things that need to be done while communicating. It's not like a language…. it's more like the RULES behind a language.

References

Demonstration

A demonstration of SIP would be the conversation with another sip registered member and its options. The options/steps are as follows:

INVITE - invites another registered sip to the call with your registered sip.

ACK - acknowledges the request and sends a retrieval of the request acknowledgement.

BYE - ends the conversation between the two sip registered members of the call.

Other things that can happen during a sip situation include but are not limited to:

CANCEL - requesting information about the remote server you are contacting.

OPTIONS - requesting to be registered with the remote server you are trying to contact.

discrete Keyword 1

equivalence/if and only if

Definition

The opposite of an XOR, if something is T and T, then it would be T when applied.

References

discrete Keyword : Right Projection (or q projection) Phase 2

Definition

Definition (in your own words) of the chosen keyword.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

hpc1 Keyword 1

X11

Definition

A graphical interface used for basic interactions with a user, mostly used in a unix os.

References

ALSA/OSS/FIREWIRE Phase 2

Definition

Definition (in your own words) of the chosen keyword.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

Experiment 1

Question

Is there a way to edit a line of code within a file while running the debugger GDB?

Resources

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 <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
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
opus/fall2012/jpettie/part1.txt · Last modified: 2012/09/30 23:59 by jpettie