Vim, GCC, gdb in Linux

Source: Internet
Author: User

In Linux, Vim is a compiler, there are two modes

    1. Vim initial mode is command mode, there are many kinds of commands in command mode

GG: Move the cursor to the first of the program

G: Move the cursor to the end of the program

8G: Move the cursor to line 8th

DD: Cut

U: Undo

YY: Copy

P: Paste

3yy: Copy 3 lines from cursor

3DD: Cut 3 lines from the cursor

SHIFT4: Moves the cursor from the beginning to the end of the line

SHIFT6: Moves the cursor from the end of the line to the beginning

Shift ~: capitalizes the lowercase letters at the cursor or vice versa

X: Delete the front of the cursor

X: Remove the character at the cursor

W: Jump Backwards in a single word

H: The cursor moves to the left in a single character unit

L: The cursor moves to the right in one character unit

K: Move Cursor up

J: Move the cursor down

5 x: Delete 5 characters in front of the cursor

B: Move forward in a single word

E: Jumps to the end of a line in a single word

yw; copy a word

R: Replace

R: Enter insert mode

2. Insert mode

I: Into insert mode, no change in cursor position

A: In insert mode, the cursor position is changed

O: In insert mode, the cursor will be spaced one line up and down

:/printf cursor directly to printf

: 8 Position to line 8th

: Set Nu Design line number

: Set Nonu undo line number

: vs file name Copy one file to another file

Ctrl+w +h/l jump cursor from one file to another

Pre-processing, compiling, and linking processes under VIM

Preprocessing: using the-e parameter allows GCC to stop the compilation process at the end of preprocessing

GCC-E Test.c-o test.i

Compile:

Gcc-s Test.i-o Test.s

Assembly:

Gcc-c Test.s-o TEST.O

Link:

GCC Test.o-o Test

GDB: Debugging is debugging an executable program

GDB Test starts debugging test

B 8 Break point in line 8th

Info B enters breakpoint

R Run

N Single Step execution

P count can be seen in the debugging process p is worth changing

P &sum can see the sum address during debugging

Delete B Deletes a breakpoint


Vim, GCC, gdb in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.