The git repository is located at [here](https://gitlab.onelab.info/mcicuttin/snippets/info0939)(`https://gitlab.onelab.info/mcicuttin/snippets/info0939`). We will use the following files:
The git repository is located at [here](https://gitlab.onelab.info/mcicuttin/snippets/info0939)(`https://gitlab.onelab.info/mcicuttin/snippets/info0939`). We will use the following files (in that order):
-`intdiv.c` for the `assert()` example on the integer division program
-`intdiv.c` for the `assert()` example on the integer division program
-`stack_corrupt.c` for a debugging exercise
-`selectionsort.c` first example of GDB usage (stepping, breakpointing & inspecting)
-`cache.c` for a profiling exercise
-`backtrace.c` second example of GDB usage (backtrace)
-`insertionsort.c` first debugging exercise
-`stack_corrupt.c` second debugging exercise
-`profiling.c` for a trivial example of use of `gprof`
-`cache.c` for an exaple of use of `cachegrind`
-`scalprod.c` profiling exercise
You can download the files on your machine or on NIC5 via `wget`:
You can download the files on your machine or on NIC5 via `wget`:
...
@@ -18,9 +23,7 @@ You can download the files on your machine or on NIC5 via `wget`:
...
@@ -18,9 +23,7 @@ You can download the files on your machine or on NIC5 via `wget`:
@@ -35,6 +38,7 @@ To debug with GDB: `gdb <progname>`, then
...
@@ -35,6 +38,7 @@ To debug with GDB: `gdb <progname>`, then
*`c`: continue until the end of the program or the next breakpoint
*`c`: continue until the end of the program or the next breakpoint
*`break <file:line>`: set a breakpoint
*`break <file:line>`: set a breakpoint
*`p`: print the value of a variable
*`p`: print the value of a variable
*`x/ct <address>` examine the contents of memory, where `c` is the count and `t` is the type. `t` takes more or less the same values of the `printf()` format specifiers. Example: `x/8d array` will print 8 integers starting from the address contained in `array`