+ All Categories
Home > Documents > Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks...

Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks...

Date post: 19-Feb-2018
Category:
Upload: dinhbao
View: 217 times
Download: 0 times
Share this document with a friend
31
Hot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems
Transcript
Page 1: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Hot Tips and Tricks for Using the Eclipse IDE

for Embedded C/C++ Development

Larry Atkinson

QNX Software Systems

Page 2: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

2

Eclipse Tips and Tricks

• Eclipse IDE

– 100 open source projects – 1,000 committers – 170 member companies – Thousands of companies embedding Eclipse – Million of users

• QNX Software Systems – big Eclipse house

– CDT originator / founding member – QNX Momentics development tools based on

Eclipse

• Top 27 favorite developer tips from:

– Poll of techies at QNX Software Systems – Excerpts from QNX IDE training course – Various websites and blogs – Eclipse.org forums and plug-in directory

– Foundry 27 IDE forum: http://foundry27.com/sf/projects/ide

Page 3: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

3

Ready, Set, Go!

• Fire up your Eclipse IDE to follow along in real-

time.

3

Page 4: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

4

#1: Show Key Assist

• Ctrl+Shift+L pops up a window that shows all

the shortcut keys that are valid within the

current context

• A second Ctrl+Shift+L brings up the key binding

configuration dialog (see next tip…)

Page 5: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

5

#2: Key Binding • Binding keyboard shortcuts to commonly used functions

Click in binding window and press key sequence

Context when shortcut operates

Conflicting key sequences shown here

Page 6: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

6

#3: Nice-to-know Keyboard Shortcuts

Word completion Alt+/ Multiple presses cycles through choices (just like tab in bash)

Next editor Ctrl+F6 Brings up selection dialog

Next perspective Ctrl+F8 Brings up selection dialog

Indent/unindent selection Tab/Backtab

Slide selection up/down Alt+Up/Down

Incremental find Ctrl+J Any navigation key ends find, use backspace and esc

Maximize/restore window Ctrl+M

Match bracket/brace Ctrl+Shift+P Cursor must be just after bracket/brace (highlight showing)

Delete row Ctrl+D For diehards missing good ole y and C-k

Page 7: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

7

#4: Refactoring

• Refactoring (Alt+Shift+T) – Hotkey for

refactoring menu

• Rename (Alt+Shift+R)

– Rename selected identifier throughout project

– Warned on conflicts or shadowing

• Constant (Alt+C)

– Extracts and names constant Select files to apply refactor

Step through change preview before accepting

Page 8: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

8

#5: Call Hierarchy

• Call hierarchy (Ctrl+Alt+H)

• Get complete list of callers of selected function or member

Can show callers or callees

Page 9: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

9

#6: Hyperlink Navigation

• Hold Ctrl while hovering over identifier and it becomes a hyperlink

• Click on link to go to symbol’s definition or prototype

Page 10: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

10

#7: Bookmarks

• Go back to your favorite (or the most

infamous) places in code

• Right-click on gray left border,

choose “Add Bookmark…”

• Show bookmarks with:

Window

Show View

Other…

General

Bookmarks

Bookmarks show in margin

Right-click in margin to add new bookmarks

Bookmark window

Page 11: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

11

#8: Prompt for Arguments During Launch

• Prompt for command-line arguments

when launching an executable by

inserting the exact literal

${string_prompt}

in the C/C++ Program Arguments in the

program's Launch Configuration

• Each time program is run, you’ll be

prompted (with the last used value as

the default)

• Result will be passed to the program on

the command-line

Page 12: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

12

#9: Template Proposals

• Save typing with templates for

often repeated code snippets

• Many common templates

already there but you can add

or customize your own:

– Window Preferences

C/C++ Editor Context

Assist Templates

• Templates can integrate

selected lines of code

Type keyword Ctrl+Space Tab walks through all fields

Page 13: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

13

#10: View Assembly Code

• Double click an object file (.o) or executable and the editor will open the window with assembly

code intermixed with the source code

Page 14: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

14

#11: Detaching Views

• Particularly handy if you are using

multiple monitors, the IDE allows you

to detach views from the main

window

• To detach a view, simply right-click on

its header and select detach

• Reattach it to the main window using

the same steps, or drag the title bar

where you want it to dock

Page 15: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

15

#12: Group Launch

• The Launch Group debug

configuration allows you to launch

several processes at the same time

• Debug multiple interacting

processes:

– Server and client

– Driver and calling applications

– HMI and supporting processes

• Combine different launch

configurations, such run Local

script, Kernel Tracing logging, or

Remote process

• Debugger starts each member

paused

Page 16: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

16

#13: Variable Directory Paths

• “Links” in Eclipse are similar to Unix soft links

• Create Eclipse project directories linked to

specific directories on your machine

OR

Create directory variables for projects sharing

one directory

• For example: create a variable SOURCE_DIR

pointing to /opt/sources

• View list of Linked Resources Variables:

Window Preferences General Workspace

Linked Resources

Page 17: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

17

#14: Custom Breakpoint Actions

• Debugger supports user- defined breakpoint

actions

• Actions can be:

– sound – log entry – resume after n seconds – external command – gdb command like “print variable”

• Can specify multiple actions per breakpoint

• Right-click on existing breakpoint and select

“Breakpoint Properties...”

Page 18: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

18

#15: Manipulating Target Files

• Must have network connection and qconn

running on target

• Open Target File System Navigator View

• Drag and drop files from host (within Eclipse

but also from other external programs) to

target folders and vice versa

• Cut and paste files

• Rename and delete files

• Launch file on target

• Directly edit target files in the IDE editor

Page 19: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

19

#16: Automated Header File Include

• Automatically insert necessary system headers

• Click or select desired function

• Right-click, select Source and Add Include (or press Ctrl+Shift+N)

• IDE inserts “#include” statement(s) that are required

Page 20: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

20

#17: Block Editing

• With a selected block, you can:

– Comment/uncomment (Ctrl+/ for C++ style with // ) – Comment/uncomment (Ctrl+Shift+/ for C style with /* */ ) – Shift right (Tab) – Shift left (Backtab) – Move up/down (Ctrl+Arrows) – Reformat (Ctrl+Shift+F), see next tip…

Page 21: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

21

#18: Reformatting Code

• Eclipse includes configurable C/C++ code formatter with predefined styles :

– Windows Preferences C/C++ Code Formatter

– Choose from:

• K&R

• BSD/Allman

• GNU

• Whitesmiths

• Or custom

– Allows flexible control

of braces, whitespace,

keywords, line wrap,

and indentation

– New code added in

specified style

– Ctrl+Shift+F applies

formatter to selection

Page 22: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

22

#19: Function Completion

• Function completion with Ctrl+Space lists matching functions

• Narrows down choices as you type

• Arrows and Enter to select…

• …will then prompt for function parameters

Page 23: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

23

#20: Automatic Structure Completion

• Automatic structure completion with Ctrl+Space

• Will complete structures or unions

• Gives element names and types

• Can be configured to trigger automatically on delay:

• Set by WindowPreferencesC/C++EditorContent Assist

Page 24: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

24

#21: Prototypes, Definitions, and Implementations

• Highlighting a function and pressing F3 will take you to the function

• Hovering over a function and pressing F2 will open a read-only “mini editor” with the function

definition, without having to browse to the file containing the function definition.

(See next tip…)

Page 25: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

25

#22: Expansion of #define’s

• F2 on a “hovered” macro will show the complete macro expansion:

Alt+arrows will expand a deep macro step-by-step

Page 26: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

26

#23: Undo and Redo

• Before saving a file, use Ctrl+Z to undo and Ctrl+Y to redo

• Default undo history size is 200 edits (set in Preferences)

• As you edit, changed lines are highlighted in the left margin:

• Hover over change bars will show the original:

Page 27: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

27

#24: Local History

• Local history stored after each file save

• Compare any two versions

• Restore changes from

previous versions

• Amount of history to

save is configurable

1

2

3

Page 28: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

28

#25: Quick Access

• Ctrl+3 pops up Quick Access

• Type to search entire workbench by name

• Searches editors, views, perspectives,

menus, commands, and anything else

in the workbench

• Quick way to get at something when

you’re not sure where it might be

Page 29: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

29

#26: Code Folding

• Folds functions, structures, etc.

into a single line

• Configured through Window Preferences

C/C++ Editor Folding

• Hover help shows contents

• Ctrl+<Numpad Divide> toggles folding on/off

• Shift+Ctrl+<Numpad Divide> folds all

expanded code

Page 30: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

Confidential Information of QNX Software Systems Limited

30

#27: Favorite Plug-ins

• Mylyn – Task tracker with interfaces to Bugzilla & Trac

– http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-587.html

• Grep Console – Console output regular expression matching

– http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1275.html

• SVN – Plugins for

– Subversive (http://www.eclipse.org/subversive)

– Subclipse (http://subclipse.tigris.org)

• NTail – Dynamic log file “tail”

– http://www.certiv.net/downloads/ntaildownload.html

• RSS View – RSS reader for bug tracking, dev forum, wikis, etc.

– http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-369.html

Page 31: Hot Tips and Tricks for Using the Eclipse IDE for Embedded ... · PDF fileHot Tips and Tricks for Using the Eclipse IDE for Embedded C/C++ Development Larry Atkinson QNX Software Systems

© 2011 QNX Software Systems Limited. QNX,

NEUTRINO, MOMENTICS, AVIAGE, PHOTON,

PHOTON MICROGUI are trademarks of QNX

Software Systems Limited, which are registered

trademarks and/or used in certain jurisdictions. All

other trademarks belong to their respective

owners. The information herein is for informational

purposes only and represents the current view of

QNX Software Systems Limited (QSS) as of the date

of this presentation. Because QSS must respond to

changing market conditions, it should not be

interpreted to be a commitment on the part of QSS,

and QSS cannot guarantee the accuracy of any

information provided after the date of this

presentation. QSS MAKES NO WARRANTIES,

REPRESENTATIONS OR CONDITIONS EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION

IN THIS PRESENTATION.

Larry Atkinson

[email protected] http://www.qnx.com

Thank you


Recommended