Working with Eclipse
From PostgreSQL Wiki
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
- Download Eclipse from http://www.eclipse.org/downloads/ ('choose the Eclipse IDE for C/C++' Developers package)
- Install and start Eclipse
- We will assume that you have setup a local copy of CVS as described at Working with CVS
- In Eclipse, go in Window->Open Perspective->CVS repositories
- Click on Add CVS Repository
- Enter the CVS information (see example below)
- Open the repository and choose the version you need (we will assume HEAD for the rest of this example)
- Right-click on the pgsql directory and select 'Check out as'
- Choose Checkout with New Project wizard and click Finish
- In the wizard, select 'New C project' and click Next
- Finally give a name to your project, and choose a 'Makefile project/Empty Project' with the 'Linux GCC' toolchain and click Finish
- The project should then be checked out from CVS
- The project will not compile and show an error
- Open a shell and go in the project directory. Run './configure --enable-depend --enable-cassert --enable-debug'
- Go back to Eclipse, right-click on the project and select 'Refresh'
- Select 'Project/Build Project' to invoke make, the output of the compilation can be seen in the console
You are now all set to use Eclipse to contribute to Postgres!
Adding make targets
- Open the Make view
- Right-click on the project and select 'Add make target'
- Enter the name of the target you want to invoke and click ok
- Double-clicking on the target will invoke the target (the output of the build can be found in the console as usual)
Debugging PostgreSQL from Eclipse
- Make sure gdb is installed on your machine
- Right click on the project in the Project Explorer window and select 'Debug As -> C/C++ Application'
- Select 'postgres' as the binary to execute
- 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
Tip: You can do a 'make install' and make your arguments points to that installed directory.
