diff --git a/doc/FAQ_DEV b/doc/FAQ_DEV index 7e0839dbfc..b30ff1337c 100644 --- a/doc/FAQ_DEV +++ b/doc/FAQ_DEV @@ -1,7 +1,7 @@ Developer's Frequently Asked Questions (FAQ) for PostgreSQL - Last updated: Sun Mar 13 22:07:18 EST 2005 + Last updated: Sat Apr 23 14:57:40 EDT 2005 Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) @@ -42,6 +42,7 @@ Technical Questions 2.5) Why do we use palloc() and pfree() to allocate memory? 2.6) What is ereport()? 2.7) What is CommandCounterIncrement()? + 2.8) What debugging features are available? _________________________________________________________________ General Questions @@ -762,3 +763,37 @@ typedef struct nameData to be broken into pieces so each piece can see rows modified by previous pieces. CommandCounterIncrement() increments the Command Counter, creating a new part of the transaction. + + 2.8) What debugging features are available? + + First, try running configure with the --enable-cassert option, many + assert()s monitor the progress of the backend and halt the program + when something unexpected occurs. + + The postmaster has a -d option that allows even more detailed + information to be reported. The -d option takes a number that + specifies the debug level. Be warned that high debug level values + generate large log files. + + If the postmaster is not running, you can actually run the postgres + backend from the command line, and type your SQL statement directly. + This is recommended only for debugging purposes. If you have compiled + with debugging symbols, you can use a debugger to see what is + happening. Because the backend was not started from postmaster, it is + not running in an identical environment and locking/backend + interaction problems may not be duplicated. + + If the postmaster is running, start psql in one window, then find the + PID of the postgres process used by psql using SELECT + pg_backend_pid(). Use a debugger to attach to the postgres PID. You + can set breakpoints in the debugger and issue queries from psql. If + you are debugging postgres startup, you can set PGOPTIONS="-W n", then + start psql. This will cause startup to delay for n seconds so you can + attach to the process with the debugger, set any breakpoints, and + continue through the startup sequence. + + You can also compile with profiling to see what functions are taking + execution time. The backend profile files will be deposited in the + pgsql/data/base/dbname directory. The client profile file will be put + in the client's current directory. Linux requires a compile with + -DLINUX_PROFILE for proper profiling. diff --git a/doc/src/FAQ/FAQ_DEV.html b/doc/src/FAQ/FAQ_DEV.html index 111fb12a0c..a9ef832f29 100644 --- a/doc/src/FAQ/FAQ_DEV.html +++ b/doc/src/FAQ/FAQ_DEV.html @@ -13,7 +13,7 @@
Last updated: Sun Mar 13 22:07:18 EST 2005
+Last updated: Sat Apr 23 14:57:40 EDT 2005
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -71,6 +71,8 @@
pfree() to allocate memory?
2.6) What is ereport()?
2.7) What is CommandCounterIncrement()?
+ 2.8) What debugging features are available?
+
First, try running configure with the --enable-cassert + option, many assert()s monitor the progress of the backend + and halt the program when something unexpected occurs.
+ +The postmaster has a -d option that allows even more + detailed information to be reported. The -d option takes a + number that specifies the debug level. Be warned that high debug + level values generate large log files.
+ +If the postmaster is not running, you can actually run the + postgres backend from the command line, and type your + SQL statement directly. This is recommended + only for debugging purposes. If you have compiled with debugging + symbols, you can use a debugger to see what is happening. Because + the backend was not started from postmaster, it is not + running in an identical environment and locking/backend interaction + problems may not be duplicated.
+ +If the postmaster is running, start psql in one
+ window, then find the PID of the postgres
+ process used by psql using SELECT pg_backend_pid()
.
+ Use a debugger to attach to the postgres PID.
+ You can set breakpoints in the debugger and issue queries from
+
+ psql. If you are debugging postgres startup, you can
+ set PGOPTIONS="-W n", then start psql. This will cause startup
+ to delay for n seconds so you can attach to the process with
+ the debugger, set any breakpoints, and continue through the startup
+ sequence.
You can also compile with profiling to see what functions are + taking execution time. The backend profile files will be deposited + in the pgsql/data/base/dbname directory. The client profile + file will be put in the client's current directory. Linux requires + a compile with -DLINUX_PROFILE for proper profiling.