我知道當讀取/寫入expresssion時,GDB中的awatch命令會中斷。但是,爲什麼當我將awatch命令設置爲我的結構指針的地址時,它只停止了一次。以下是我的GDB和代碼片段的屏幕截圖。請指教。謝謝。awatch不停止在指定地址
Testing.c
College_Record *college = NULL;
college = malloc(sizeof(College_Record));
printf("college %p\n", college);
free(college);
printf("college %p\n", college);
college = NULL;
printf("college %p\n", college);
printf("***************************\n");
printf("\tDONE OKAY\n");
printf("***************************\n");
return 0;
Testing.h
typedef struct {
int college_id;
char school[20];
} College_Record;
您已經刪除指針,因此可能是0x602010。或者,awatch -l 0x602010。簡單的方法可能是awatch -l * college –
awatch -l * college說「表達式中的語法錯誤,靠近'{...} *)0x0000000000602010'。」另外,awatch 0x602010或awatch -l 0x602010表示「無法觀看常量值0x602010」。「 – Marss