Difference between revisions of "LU-LSP-b11:L11"

From DiLab
Jump to: navigation, search
(New page: LSP11: ''gdb'' lietošana ''valgrind'' lietošana)
 
Line 4: Line 4:


''valgrind'' lietošana
''valgrind'' lietošana

#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <unistd.h>

char string[] = "hello world 1234567890";

int crash(int *pi)
{
*pi = 0x1;
}
int f(void)
{
crash(NULL);
}
int main()
{
f();
printf("%s\n", string);
return 0;
}

Revision as of 16:44, 22 November 2011

LSP11:

gdb lietošana

valgrind lietošana

#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <unistd.h>
char string[] = "hello world 1234567890";
int crash(int *pi)
{
    *pi = 0x1;
}

int f(void)
{
    crash(NULL);
}

int main()
{ 
    f();
    printf("%s\n", string);
    return 0;
}