Thread: debugger question

debugger question

From
"Murali M. Krishna"
Date:
<table border="0" cellpadding="0" cellspacing="0"><tr><td style="font: inherit;" valign="top">Hello:<br /><br />I am
brandnew to Postgresql.<br /><br />I ran the following commands.<br /><pre class="SYNOPSIS">./configure<br />gmake<br
/>su<br/>gmake install<br />adduser postgres<br />mkdir /usr/local/pgsql/data<br />chown postgres
/usr/local/pgsql/data<br/>su - postgres<br />/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data<br
/>/usr/local/pgsql/bin/postmaster-D /usr/local/pgsql/data >logfile 2>&1 &<br
/>/usr/local/pgsql/bin/createdbtest<br />/usr/local/pgsql/bin/psql test<br /><br />I would like to start using gdb.<br
/><br/>What is the simplest way of doing this? I read the instructions<br />on this page<br /><br
/>http://sites.google.com/a/cs.berkeley.edu/cs186-fa09/home/assignments/assignment2/pggdb<br/><br />, but this is what
Iget.<br /><br /><br />gdb) attach 1731<br />Attaching to program: /usr/local/pgsql/bin/postgres, process 1731<br
/>ptrace:Operation not permitted.<br />(gdb)break cost_seqscan<br />Breakpoint 1 at 0x81cdf97: file costsize.c, line
163.<br/>(gdb) c<br />The program is not being run.<br /><br />-----<br /><br />Please help.<br /><br />Thanks.<br
/><br/>MMK.<br /><br /><br /><br /><br /><br /><br /></pre><br /><br /><br /><br /><br /><br /><br
/>-----------------------------------------------------------------<br/>Please visit <a href="http://NumberFest.com"
rel="nofollow"target="_blank">NumberFest.com</a> for educational number puzzles & mind exercises for all ages! And
pleasetell your friends about it. Thank You!<br /></td></tr></table><br /> 

Re: debugger question

From
tomas@tuxteam.de
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Apr 12, 2010 at 08:31:38PM -0700, Murali M. Krishna wrote:
> Hello:
> 
> I am brand new to Postgresql.
> 
> I ran the following commands.
> ./configure
> gmake
> su
> gmake install
> adduser postgres
> mkdir /usr/local/pgsql/data
> chown postgres /usr/local/pgsql/data
> su - postgres
> /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
> /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
> /usr/local/pgsql/bin/createdb test
> /usr/local/pgsql/bin/psql test
> 
> I would like to start using gdb.
> 
> What is the simplest way of doing this? I read the instructions
> on this page
> 
> http://sites.google.com/a/cs.berkeley.edu/cs186-fa09/home/assignments/assignment2/pggdb
> 
> , but this is what I get.
> 
> 
> gdb) attach 1731
> Attaching to program: /usr/local/pgsql/bin/postgres, process 1731
> ptrace: Operation not permitted.
> (gdb) break cost_seqscan
> Breakpoint 1 at 0x81cdf97: file costsize.c, line 163.
> (gdb) c
> The program is not being run.

Hm. Seems you got the right PID (gdb finds the executable after all).
Are you perhaps running under SELinux? (i just boldly assumed some
GNU/Linux). Which distribution, which kernel version (there seems to be
a bug in 2.4-ish Linux kernels which manifests itself like that, but
that's quite a while ago).

Next time, please tell us what OS is under you (although it might be fun
to watch people make wild guesses :)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLw/LTBcgs9XrR2kYRArYMAJ9JHu/Sl5JWSAv77om9HXHIzZtrDACZAWWu
fpk1yLbio8KOcWjTEWCXrK4=
=z0qo
-----END PGP SIGNATURE-----


Re: debugger question

From
"Murali M. Krishna"
Date:
<table border="0" cellpadding="0" cellspacing="0"><tr><td style="font: inherit;" valign="top">The OS is<br /><br
/>Fedora12.<br /><br /><br /><br /><br /><br /><br
/>-----------------------------------------------------------------<br/>Please visit <a href="http://NumberFest.com"
rel="nofollow"target="_blank">NumberFest.com</a> for educational number puzzles & mind exercises for all ages! And
pleasetell your friends about it. Thank You!<br /><br /><br />--- On <b>Mon, 4/12/10, tomas@tuxteam.de
<i><tomas@tuxteam.de></i></b>wrote:<br /><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left:
5px;padding-left: 5px;"><br />From: tomas@tuxteam.de <tomas@tuxteam.de><br />Subject: Re: [HACKERS] debugger
question<br/>To: "Murali M. Krishna" <murali1729@yahoo.com><br />Cc: pgsql-hackers@postgresql.org<br />Date:
Monday,April 12, 2010, 9:28 PM<br /><br /><div class="plainMail">-----BEGIN PGP SIGNED MESSAGE-----<br />Hash: SHA1<br
/><br/>On Mon, Apr 12, 2010 at 08:31:38PM -0700, Murali M. Krishna wrote:<br />> Hello:<br />> <br />> I am
brandnew to Postgresql.<br />> <br />> I ran the following commands.<br />> ./configure<br />> gmake<br
/>>su<br />> gmake install<br />> adduser postgres<br />> mkdir /usr/local/pgsql/data<br />> chown
postgres/usr/local/pgsql/data<br />> su - postgres<br />> /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data<br
/>>/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &<br />>
/usr/local/pgsql/bin/createdbtest<br />> /usr/local/pgsql/bin/psql test<br />> <br />> I would like to start
usinggdb.<br />> <br />> What is the simplest way of doing this? I read the instructions<br />> on this
page<br/>> <br />> <a
href="http://sites.google.com/a/cs.berkeley.edu/cs186-fa09/home/assignments/assignment2/pggdb"
target="_blank">http://sites.google.com/a/cs.berkeley.edu/cs186-fa09/home/assignments/assignment2/pggdb</a><br/>>
<br/>> , but this is what I get.<br />> <br />> <br />> gdb) attach 1731<br />> Attaching to program:
/usr/local/pgsql/bin/postgres,process 1731<br />> ptrace: Operation not permitted.<br />> (gdb) break
cost_seqscan<br/>> Breakpoint 1 at 0x81cdf97: file costsize.c, line 163.<br />> (gdb) c<br />> The program is
notbeing run.<br /><br />Hm. Seems you got the right PID (gdb finds the executable after all).<br />Are you perhaps
runningunder SELinux? (i just boldly assumed some<br />GNU/Linux). Which distribution, which kernel version (there
seemsto be<br />a bug in 2.4-ish Linux kernels which manifests itself like that, but<br />that's quite a while ago).<br
/><br/>Next time, please tell us what OS is under you (although it might be fun<br />to watch people make wild guesses
:)<br/><br />Regards<br />- -- tomás<br />-----BEGIN PGP SIGNATURE-----<br />Version: GnuPG v1.4.6 (GNU/Linux)<br /><br
/>iD8DBQFLw/LTBcgs9XrR2kYRArYMAJ9JHu/Sl5JWSAv77om9HXHIzZtrDACZAWWu<br/>fpk1yLbio8KOcWjTEWCXrK4=<br />=z0qo<br
/>-----ENDPGP SIGNATURE-----<br /><br />-- <br />Sent via pgsql-hackers mailing list (<a
href="/mc/compose?to=pgsql-hackers@postgresql.org"
ymailto="mailto:pgsql-hackers@postgresql.org">pgsql-hackers@postgresql.org</a>)<br/>To make changes to your
subscription:<br/><a href="http://www.postgresql.org/mailpref/pgsql-hackers"
target="_blank">http://www.postgresql.org/mailpref/pgsql-hackers</a><br/></div></blockquote></td></tr></table><br /> 

Re: debugger question

From
Tom Lane
Date:
"Murali M. Krishna" <murali1729@yahoo.com> writes:
> I would like to start using gdb.
> ...
> , but this is what I get.

> gdb) attach 1731
> Attaching to program: /usr/local/pgsql/bin/postgres, process 1731
> ptrace: Operation not permitted.

Try running gdb as the postgres user, ie, su to postgres first.
If that doesn't work, see if it works after disabling selinux
(and if so, file a bug, because selinux shouldn't prevent it).
        regards, tom lane