Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Minimal Eclipse

A minimal Eclipse configuration for managing project and support notes:

  • Eclipse 3.7.1 Platform Runtime Binary
  • Eclipse Java Development Tools (for e.g. Ant support)
  • Eclipse Marketplace Client
  • EGit
  • Mylin (Task Management)
  • Jira connector (Atlassian Connector for Eclipse)
  • Web Tools Platform (Eclipse XML Editors and Tools)

Task tags in Eclipse

When I'm working on source code, I often tend to make little notes in the code in the form of TODO comments. All of these are then listed in the Eclipse 'Tasks' view.

What I only just realised is that, in Eclipse, I can define my own tags and automatically assign them a priority. This is done in Eclipe "Preferences...Java...Compiler...Task Tags". The default tag is TODO with priority of normal. There is also a FIXME tag already defined, with high priority. In the 'Tasks' view, high priority tags appear highlighted.

In addition to those, I defined a DEBT tag, which I'm using to indicate technical debt, i.e. a quick hack that should really be changed.

Debugging a C child process using Eclipse

When we are debugging an application that uses C forks in Eclipse, by default the debugger is not configured to follow into the forked child process. Entering set follow-fork-mode child into the console has no effect.

A workaround for this is to create a .gdbinit file that contains set follow-fork-mode child in the project root folder. In the Eclipse gdb preferences, ensure that this is referenced by the setting for "GDB command file".

Note: A more flexible option (as it should ask at each fork) is: set follow-fork-mode ask. I have not tried this out in Eclipse though, and unfortunately not all gdb command line instructions work in Eclipse.

Add Symbols to a C project in Eclipse (Linux)

In an Eclipse C project, code that is wrapped in #ifdef...#endif is not indexed by the C/C++ indexer. Any code using it shows up with syntax errors.

The way to fix this:
  • open Project...Properties
  • Go to C/C++ General...Paths and Symbols
  • Open the Symbols tab
  • Add each symbol that needs to be defined (with a value of 1)

This is the same as adding the #define in the source code.

It is also equivalent to using -D switches to CFLAGS in a Makefile. For example, if the makefile has...

...
CFLAGS = -c $(INC) -DFEATURE_A
...

...then FEATURE_A should be defined in Eclipse as a symbol with value 1.

I am using Eclipse Indigo 3.7 with CDT.