Working with Eclipse

From PostgreSQL Wiki

Jump to: navigation, search

Contents

Developing with Eclipse

This page explains how to get quickly started if you want to use Eclipse to develop PostgreSQL.

The original version of this page has been created based on Eclipse Ganymede v3.4.1 for Linux.


Setting up your workspace

  1. Download Eclipse from http://www.eclipse.org/downloads/ ('choose the Eclipse IDE for C/C++' Developers package)
  2. Install and start Eclipse
  3. We will assume that you have setup a local copy of CVS as described at Working with CVS
  4. In Eclipse, go in Window->Open Perspective->CVS repositories
  5. Click on Add CVS Repository
  6. Enter the CVS information (see example below)
    CVS repository settings
  7. Open the repository and choose the version you need (we will assume HEAD for the rest of this example)
  8. Right-click on the pgsql directory and select 'Check out as'
    CVS checkout
  9. Choose Checkout with New Project wizard and click Finish
    Project setup
  10. In the wizard, select 'New C project' and click Next
    Project setup
  11. Finally give a name to your project, and choose a 'Makefile project/Empty Project' with the 'Linux GCC' toolchain and click Finish
    Project setup
  12. The project should then be checked out from CVS
    CVS checkout
  13. The project will not compile and show an error
    Build error
  14. Open a shell and go in the project directory. Run './configure --enable-depend --enable-cassert --enable-debug'
    Run configure
  15. Go back to Eclipse, right-click on the project and select 'Refresh'
  16. Select 'Project/Build Project' to invoke make, the output of the compilation can be seen in the console
    Project build


You are now all set to use Eclipse to contribute to Postgres!


Adding make targets

  1. Open the Make view
  2. Right-click on the project and select 'Add make target'
    Make target
  3. Enter the name of the target you want to invoke and click ok
    Make target
  4. Double-clicking on the target will invoke the target (the output of the build can be found in the console as usual)
    Make target


Debugging PostgreSQL from Eclipse

  1. Make sure gdb is installed on your machine
  2. Right click on the project in the Project Explorer window and select 'Debug As -> C/C++ Application'
    Debug in Eclipse
  3. Select 'postgres' as the binary to execute
    Debug in Eclipse
  4. If you don't have PGDATA set in the environment Eclipse is running in, you can tune the command line arguments in Run/Debug Configurations so that Postgres can start properly
    Debug in Eclipse


Tip: You can do a 'make install' and make your arguments points to that installed directory.

Personal tools