cờ tùy chọn gcc -g

gcc -g tạo thông tin gỡ lỗi để trình gỡ lỗi GDB sử dụng.

 

lựa chọn Sự miêu tả
-g0 không có thông tin gỡ lỗi
-g1 thông tin gỡ lỗi tối thiểu
-g thông tin gỡ lỗi mặc định
-g3 thông tin gỡ lỗi tối đa

cú pháp

$ gcc -glevel [options] [source files] [object files] [-o output file]

Ví dụ

Ghi tệp nguồn myfile.c :

// myfile.c
#include <stdio.h>
 
void main()
{
    printf("Program run!!\n");
}

 

Xây dựng myfile.c trên thiết bị đầu cuối và chạy gdb để gỡ lỗi:

$ gcc -g myfile.c -o myfile
$ gdb myfile
(gdb) run
Starting program: /home/ubuntu/myfile
Program run!!
Program exited with code 012.
(gdb) quit
$

 


Xem thêm

Advertising

GCC
°• CmtoInchesConvert.com •°