[pgrouting-dev] Some issues and current status

Stephen Woodbridge woodbri at swoodbridge.com
Fri Jun 1 08:35:00 PDT 2012


On 6/1/2012 10:36 AM, Razequl Islam wrote:
> hi Steve,
>
> 1. How can i test run and debug my code using postgres. Now i am running
> the test code on a sample network data file using a program to read
> input and feed data.

There are two ways to debug code in postgresql. I have only used the 
first so I'm not sure that I can help much on the second.

1. add debug output from the C code

* change to the trsp branch
* cd /extra/trsp/src
* vi trsp.c and search for DBG(
* add the following to your code

//#undef DEBUG
#define DEBUG 1

#ifdef DEBUG
#define DBG(format, arg...)                     \
     elog(NOTICE, format , ## arg)
#else
#define DBG(format, arg...) do { ; } while (0)
#endif

Then you can add DBG(format_string, args,...) to you code. When you run 
you code from psl or pgadmin it will display the NOTICE messages.

2. there is a way to start postgresql up in single user mode in gdb and 
you can set break points in your functions. I'm guessing that you then 
connect with psql and issue your query from another shell and you should 
get a break at your break points and can then step through the code in 
gdb. Like I said, I have not done this. When we did trsp we verified 
that the algorithm was correct using a test program like you have done, 
then we only need to debug the SQL fetching data and passing it to the 
function in the same way the test program passed data.


> 2. Should i commit my code in the repository fork i have created?

Yes, and post a note with the url to browse the code and ask for a 
review. You should consider the review input, but feel free to defend 
you position if you feel good about your code. Ultimately, it is your 
project so you need to move forward to meet your goals. If people make 
good comments you are free to accept them and incorporate them or to 
ignore them.

> Now I am working on the first version of bi-directional using two STL
> priority queue.

Great, I look forward to see how that is going. It is Friday so don't 
forget to get your status report updated for this week.

Thanks,
   -Steve

> Regards,
> Razequl
>
>
> _______________________________________________
> pgrouting-dev mailing list
> pgrouting-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev



More information about the pgrouting-dev mailing list