From: Mart Lubbers Date: Mon, 9 Mar 2015 14:48:48 +0000 (+0100) Subject: ass5aexb X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=123c03586cc09674006c8217a7c8075bd3b2aa27;p=sws1-1415.git ass5aexb --- diff --git a/ass5a/sws1-assignment5-s4109503-s4202015/exercise2b b/ass5a/sws1-assignment5-s4109503-s4202015/exercise2b new file mode 100644 index 0000000..0aa5bce --- /dev/null +++ b/ass5a/sws1-assignment5-s4109503-s4202015/exercise2b @@ -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 diff --git a/ass5a/sws1-assignment5-s4109503-s4202015/exercise2a.c b/ass5a/sws1-assignment5-s4109503-s4202015/exercise3.c similarity index 73% rename from ass5a/sws1-assignment5-s4109503-s4202015/exercise2a.c rename to ass5a/sws1-assignment5-s4109503-s4202015/exercise3.c index 66cdd55..bbceb78 100644 --- a/ass5a/sws1-assignment5-s4109503-s4202015/exercise2a.c +++ b/ass5a/sws1-assignment5-s4109503-s4202015/exercise3.c @@ -1,13 +1,9 @@ #include -#include 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"); }