Starting loki programming guide
This commit is contained in:
2
loki_sample/gdb_example/Makefile
Normal file
2
loki_sample/gdb_example/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
ALL:
|
||||
gcc -ggdb buggy.c -o buggy
|
1
loki_sample/gdb_example/NOTES
Normal file
1
loki_sample/gdb_example/NOTES
Normal file
@@ -0,0 +1 @@
|
||||
this did not help me figure out gdb; however, clang happily showed me the issue easily. However, DDD worked amazingly. All I have to do is add a breakpoint and then run the program. It shows results as it goes. It's great!
|
11
loki_sample/gdb_example/buggy.c
Normal file
11
loki_sample/gdb_example/buggy.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++); // The bug is this extra semicolon
|
||||
printf("Counter is now %i\n",i);
|
||||
return 0;
|
||||
}
|
||||
// Should (wrongfully) only print out "Counter is now 10"
|
||||
// Note that GCC does not report an error. Clang reports the error.
|
Reference in New Issue
Block a user