ass5aexb
authorMart Lubbers <mart@martlubbers.net>
Mon, 9 Mar 2015 14:48:48 +0000 (15:48 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 9 Mar 2015 14:48:48 +0000 (15:48 +0100)
ass5a/sws1-assignment5-s4109503-s4202015/exercise2b [new file with mode: 0644]
ass5a/sws1-assignment5-s4109503-s4202015/exercise3.c [moved from ass5a/sws1-assignment5-s4109503-s4202015/exercise2a.c with 73% similarity]

diff --git a/ass5a/sws1-assignment5-s4109503-s4202015/exercise2b b/ass5a/sws1-assignment5-s4109503-s4202015/exercise2b
new file mode 100644 (file)
index 0000000..0aa5bce
--- /dev/null
@@ -0,0 +1,52 @@
+(gdb) break function_b
+(gdb) run
+(gdb) info stack
+(gdb) frame 0
+(gdb) info frame
+
+For knowing register values I did
+(gdb) i r REGISTERNAME
+
+For all values i did:
+(gdb) x 0xADDRESS
+
+Data                   Question
+===============================================================================
+0                      which frame it is
+function_b             which function the frame belongs to
+0x7fffffffe850         the location (address in memory) of the frame
+0x7fffffffe870         the location of the frame it was called by
+0x40050e               the value of the instruction pointer
+0x7fffffffe870         the location of the return address,
+0x400560               the value of the return address,
+0x7fffffffe840         the value of the base pointer
+0x7fffffffe840         the location of the saved base pointer,
+0x7fffffffe860         the value of the saved base pointer,
+0x400560               the value of the stack pointer
+0x7fffffffe840         the address of the local variable
+
+1                      which frame it is
+function_a             which function the frame belongs to
+0x7fffffffe870         the location (address in memory) of the frame
+0x7fffffffe880         the location of the frame it was called by
+0xfe9ee80040060ebf     the value of the instruction pointer
+0x7fffffffe860         the location of the return address
+0x7fffffffe870         the value of the return address
+0x7fffffffe870         the value of the base pointer
+0x7fffffffe860         the location of the saved base pointer,
+0x7fffffffe870         the value of the saved base pointer
+0x7fffffffe870         the value of the stack pointer
+0x7fffffffe860         the address of the local variable
+
+2                      which frame it is
+main                   which function the frame belongs to
+0x7fffffffe880         the location (address in memory) of the frame
+0x7fffffffe870         the location of the frame it was called by
+0xfe89e800400622bf     the value of the instruction pointer
+0x7fffffffe870         the location of the return address
+0x7fffffffe870         the value of the return address
+0x400560               the value of the base pointer
+0x7fffffffe870         the location of the saved base pointer,
+0x400560               the value of the saved base pointer
+0x400560               the value of the stack pointer
+0x7fffffffe870         the address of the local variable
@@ -1,13 +1,9 @@
 #include <stdio.h>
-#include <string.h>
 
 void function_b(void)
 {
        char buffer[4];
-       char *p = buffer;
-       while(*(int *)++p != (int)0xa0b1c2d3);
-       while(--p > buffer)
-               *p = 0;
+
        printf("Executing function_b\n");
 }