Your SlideShare is downloading. ×
Basics
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Basics

612

Published on

A small presentation I prepared for the basics of vim, gcc and gdb.

A small presentation I prepared for the basics of vim, gcc and gdb.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
612
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Topics
    • Vim
    • 2. Programming in C using gcc
    • 3. Using gdb-GNU Debugger
    • 4. Shell Scripting
  • 5. Basics
  • 12. Why Vim?
    • Simple to use
    • 13. Has all the features that must be there in a basic editor
    • 14. Unlimited undo
    • 15. Syntax colouring
    • 16. Visual selection
    • 17. Split windows
    • 18. Also has a GUI interface - Gvim
    • 19. Many more......
  • 20. Vim Basics
    • Start vim --- vim test.c
    • 21. Open multiple files using -o and -O attributes
    • 22. Insertion
    • 23. Deletion
    • 24. Dw to delete a word from the cursor
    • 25. Cw to change a word from the cursor
    • 26. Dd and cc to delete & change a line respectively
    • 27. Esc to cancel your commads
    • 28. Replace
  • 29. Vim Basics
    • Playing with the cursor
    • 30. Use normal arrow keys or h,j,k,l to move the cursor left,down,up,right.
    • 31. Ctrl-f and ctrl-b for page down and page up.
    • 32. 1G, nG, G to move to first, nth and last line.
    • 33. 0 or ^ and $ for start and end of a particular line.
    • 34. w and e for moving to start of next word and end of next word and b for moving to the previous word.
    • 35. ( and ) for start and end of a sentence and { and } for start and end of paragraph.
    • 36. H, M and L to move the cursor to the top,middle and bottom of the screen.
  • 37. Vim basics
    • Some more short-cuts to edit
    • 38. Yy and yw to yank a line and a word
    • 39. p to paste
    • 40. Adding a number in front of the command repeats the command so many times, example, 12yy, 3i
    • 41. Visual Mode
    • 42. v, V and Ctrl-V for visual mode of a character, line and block respectively
    • 43. d-delete ,y-yank,U-convert to uppercase,u-convert to lowercase, ~ -togle,<-unident ,> - ident
    • 44. Undo the last change using 'u' in normal mode
  • 45. Vim Basics
    • Search for a word using '/', n and N to get next and previous match
    • 46. Search and replace using %s/old/new/gc
    • 47. %: the range of whole file, can replace with a range of lines like (2,50)
    • 48. s: substitution
    • 49. old: old pattern to match
    • 50. new: new pattern for replacement
    • 51. g: global
    • 52. c: confirm for every replacement
    • 53. Split and vs for horizontal and vertical split
    • 54. '!' can be used to execute commands
    • 55. Ctrl-p in insert mode shows suggestions in autocomplete
  • 56. Gcc basics
    • GCC developed by Richard M Stallman as a part of GNU Project
    • 57. First release in 1987 and in 1992, second release feature to compile
    • 58. c++ was added.
    • 59. Features of GCC
    • 60. It is a portable compiler, runs on most platforms including microcontrollers,DSPs and 64-bit CPUs
    • 61. GCC is not only a native compiler but also a cross compiler and hence can produce executables for a different system than itself. It can compile itself.
    • 62. It has multiple language front-ends for parsing different languages.
    • 63. It has a modular design, hence allowing new languages and architectures to be added very easily
    • 64. GCC is completely free software!!!!
  • 65. Gcc Basics
    • How does gcc compile the source code into executable?
    • 66. Preprocessing (to expand macros)
    • 67. cpp hello.c > hello.i (for c++, it is .ii)
    • 68. Compilation (from source code to assembly language)
    • 69. gcc -Wall -S hello.i (-S instructs the compiler not to create the object file)
    • 70. Assembly (from assembly language to machine code)
    • 71. as hello.s -o hello.o (calls to external functions are left undefined to be filled later by the linker)
    • 72. Linking (to create the final executable)
    • 73. gcc hello.o
    • 74. Run ./a.out to get ”Hello, World!”
    as hello.s -o hello.o
  • 75. Gcc basics
    • In short, to compile the source code use
    • 76. gcc -Wall hello.c , the executable is stored as a.out
    • 77. or
    • 78. gcc -Wall hello.c -o hello , the executable is stored as hello
    • 79. To execute the executable
    • 80. ./a.out or ./hello
  • 81. Gdb basics
    • Normal DeBugging Techniques
    • 82. Insert lots of printf statements.
    • 83. Insert lots of assert statements.
    • 84. Use a debugger to find out where your code went wrong.
    • 85. Uses of Gdb
    • 86. Used to examine the code, line by line and check the status variables.
    • 87. Very important in situations like segmentation faults
  • 88. GDB basics
  • 95. Thank you T. Vignesh Prabhu (tvigneshprabhu@gmail.com)

×