当前位置:网站首页>gcc/g++ use
gcc/g++ use
2022-08-08 05:30:00 【asibble】
gcc/g++ use
This is the compiler, doing related things.This is an open source compiler that compiles c and c++.
Procedure:
1, Preprocessing
2, Assembly
3, Link
Preprocessing
gcc -E does preprocessing and redefines an output file.
After preprocessing
gcc -E main.c -o main.iGenerate related .i files and become related things.
Compile (generate assembly)
gcc -c main.s -o main.oAssembly generates the content of main.o file, which can be directly preprocessed into assembly.
Assembly (generates machine-identifiable code)
gcc -c main.c -o main.oGenerate .o files directly.
Link (generate executable or library)
gcc main.o -o mainGenerate the main file and turn it into something corresponding.
Library
When compiling and linking, the library files are processed differently, and the static library and dynamic library are different.
Static library
Static library means that when compiling and linking, all the code of the library file is added to the executable file, so the generated file is relatively large, but the library file is no longer needed at runtime.The suffix is usually ".a"
Dynamic library
The library is not placed in the executable program, and the library file is dynamically extracted during the running process.
Save space and overhead on the system, the dynamic library suffix is ".so".
Debugger gdb use
The use of gdb is basically related to the use of release mode.The basic things are used in the same way as debugging, but they are adjusted with simple code, not related to the previous steps.(Xcode can also perform related operations)
The relevant executable program is obtained after the gcc reaction, and then
gdb test //test executable program1,b (break) + line number: break point
2, d (delete) + breakpoint number: delete breakpoint
3,l + line number: display code
4, s (step): statement by statement (enter function)
5, n (next): process by process
6, display && undisplay: line display or cancel normal display
7, until + line number: jump to the specified line
8, r(run): run the program
9, c (continue): from one breakpoint to the next breakpoint
10, finish: stop when the execution completes a two-digit number*!
11, j(jump) + line number: jump to the specified line
12, k (kill): terminate the program running
13,i(info) : View the value of the local variable of the current stack frame
边栏推荐
猜你喜欢

Use of Filter

The only OpenCyphal/UAVCAN tutorial in the whole network (11) Write a Cyphal protocol parsing tool with candump and gawk tools

【Win10】Several sleep problems and countermeasures

IP核之RAM实验

Unity-CharacterController(角色控制器)

分类、目标检测、语义分割、实例分割的区别

研发医疗器械产品需要做的测试

仿记事本;QFile

apifox使用文档之环境变量 / 全局变量 / 临时变量附apifox学习路线图

什么是 DevOps?看这一篇就够了!
随机推荐
仿记事本;QFile
MySQL4 (multi-table query)
仿QQ好友列表,QListWidget!
【OAuth2】十八、OIDC的认识应用
单主机docker 搭建 redis-cluster
LVS:NAT模式详解
MySQL4(多表查询)
Flatten multidimensional array to one dimension
Servlet---ServletConfig类使用介绍
什么是 DevOps?看这一篇就够了!
多维度数组拉平到一维
28. Anomaly detection
Preprocessing Notes
bpftrace:简便输出调试信息
Week 8 Transformer Language Models and Implications
CAP定理实例分析
分布式事务 :可靠消息最终一致性方案
数据库分库分表,何时分?怎样分?
《动机与人格》笔记(二)——认识和理解的欲望
报错:[Intervention] Unable to preventDefault inside passive event listener due to target ...