Thread: Debugging the backend?

Debugging the backend?

From
Dmitry Tkach
Date:
Hi, everybody!

This may be a stupid question (and is most definitely a wrong list to post it), but I am just desperate,
and out of ideas...
If anyone has any clue at all what may be the problem, I would greatly appreciate your help!

I am trying to debug the backend process with gdb... So, I set CFLAGS to '-g', ran make and installed the
executable.The problem is, when I am trying to attach to it with GDB, it seems to have no source file information
at all! It is debugabble - I can print variables, see function names and parameters etc... But, whatever I do, it just
does not know anything about the source (not even filenames, and line numbers)!

Do you have any idea what may be wrong? Perhaps, it is some compiler flag I should have set?
Or, is it a gdb problem? Or am I just going crazy?

Any help will be GREATLY appreciated!

Thanks a lot!

Dima


Re: Debugging the backend?

From
Oliver Elphick
Date:
On Thu, 2002-09-19 at 18:25, Dmitry Tkach wrote:
> I am trying to debug the backend process with gdb... So, I set CFLAGS to '-g', ran make and installed the
> executable.The problem is, when I am trying to attach to it with GDB, it seems to have no source file information
> at all! It is debugabble - I can print variables, see function names and parameters etc... But, whatever I do, it
just
> does not know anything about the source (not even filenames, and line numbers)!

In gdb you can specify a directory from which to load source files, if
necessary.  I find that if you cd to the directory where the excutable
was compiled before running it, this is not usually necessary.

The gdb command to add a directory to the search path is "path
/path/to/dir", and the specified directory is added at the front of the
search path.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Bring ye all the tithes into the storehouse, that
      there may be meat in mine house, and prove me now
      herewith, saith the LORD of hosts, if I will not open
      you the windows of heaven, and pour you out a
      blessing, that there shall not be room enough to
      receive it."           Malachi 3:10


Re: Debugging the backend?

From
Tom Lane
Date:
Oliver Elphick <olly@lfix.co.uk> writes:
> On Thu, 2002-09-19 at 18:25, Dmitry Tkach wrote:
>> executable.The problem is, when I am trying to attach to it with GDB, it seems to have no source file information
>> at all! It is debugabble - I can print variables, see function names and parameters etc... But, whatever I do, it
just
>> does not know anything about the source (not even filenames, and line numbers)!

> In gdb you can specify a directory from which to load source files, if
> necessary.  I find that if you cd to the directory where the excutable
> was compiled before running it, this is not usually necessary.

I find that it generally Just Works, as long as I give the correct path
to the postgres-executable-with-debug-info on the gdb command line.
I've only ever had to specify a source directory in weird cases
involving dynamically linked shared libraries.  If you're trying to
debug the main backend then that shouldn't apply...

            regards, tom lane

Re: Debugging the backend?

From
"Shridhar Daithankar"
Date:
On 19 Sep 2002 at 19:45, Oliver Elphick wrote:
> In gdb you can specify a directory from which to load source files, if
> necessary.  I find that if you cd to the directory where the excutable
> was compiled before running it, this is not usually necessary.
>
> The gdb command to add a directory to the search path is "path
> /path/to/dir", and the specified directory is added at the front of the
> search path.

Well gdb commands 'dir' and 'path are two different things..

(gdb) help path
Add directory DIR(s) to beginning of search path for object files.
$cwd in the path means the current working directory.
This path is equivalent to the $PATH shell variable.  It is a list of
directories, separated by colons.  These directories are searched to find
fully linked executable files and separately compiled object files as needed.
(gdb) help dir
Add directory DIR to beginning of search path for source files.
Forget cached info on source file locations and line positions.
DIR can also be $cwd for the current working directory, or $cdir for the
directory in which the source file was compiled into object code.
With no argument, reset the search path to $cdir:$cwd, the default.
(gdb)

:-)

Bye
 Shridhar

--
Ryan's Law:    Make three correct guesses consecutively    and you will establish
yourself as an expert.