Re: [HACKERS] debugger question

2010-04-13 Thread Tom Lane
Murali M. Krishna murali1...@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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] debugger question

2010-04-12 Thread Murali M. Krishna
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 21 
/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.

-

Please help.

Thanks.

MMK.













-
Please visit NumberFest.com for educational number puzzles  mind exercises for 
all ages! And please tell your friends about it. Thank You!



  

Re: [HACKERS] debugger question

2010-04-12 Thread tomas
-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 21 
 /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-

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] debugger question

2010-04-12 Thread Murali M. Krishna
The OS is

Fedora 12.






-
Please visit NumberFest.com for educational number puzzles  mind exercises for 
all ages! And please tell your friends about it. Thank You!


--- On Mon, 4/12/10, to...@tuxteam.de to...@tuxteam.de wrote:

From: to...@tuxteam.de to...@tuxteam.de
Subject: Re: [HACKERS] debugger question
To: Murali M. Krishna murali1...@yahoo.com
Cc: pgsql-hackers@postgresql.org
Date: Monday, April 12, 2010, 9:28 PM

-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 21 
 /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-

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



  

Re: [HACKERS] Debugger

2007-10-20 Thread Heikki Linnakangas
Pedro Belmino wrote:
 4. Tried to attach the id of the process to the debugger and gave the error:
 Unable to open socket file: target process not responding or HotSpot VM not
 loaded

You're trying to use a Java debugger to attach to a non-Java program
(Postgres). That's not going to work. Use a tool like gdb or ddd instead.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] debugger

2007-10-19 Thread Martijn van Oosterhout
On Fri, Oct 19, 2007 at 08:23:43AM -0300, Pedro Belmino wrote:
 Hellow,
 I continue to have problems using the debugger, can not achieve any
 breakpoint that is outside the postmaster.c? Can anyone give me any hint?
 Where do I mark a breakpoint so that I can follow the creation of an index
 to file index.c for example?
 Thank,

Are you correctly attaching the debugger to the child (and not just the
postmaster).

Have a nice day,
-- 
Martijn van Oosterhout   [EMAIL PROTECTED]   http://svana.org/kleptog/
 From each according to his ability. To each according to his ability to 
 litigate.


signature.asc
Description: Digital signature


Re: [HACKERS] Debugger

2007-10-19 Thread Pedro Belmino
I am using linux.
1. Inicializei the postgres the console by running. / Postgres.
2. Joined in psql through console and simulated. / Psql
3. Pg_backend_pid swirled SELECT () to get the id of the process;
4. In ide tried to use that process to attach the debugger but gives the
following error message:
Unable to open file socket: target process not responding HotSpot VM or not
loaded

Thank,
2007/10/19, Gregory Stark [EMAIL PROTECTED]:


 Pedro Belmino [EMAIL PROTECTED] writes:

  Hellow,
  I continue to have problems using the debugger, can not achieve any
  breakpoint that is outside the postmaster.c? Can anyone give me any
 hint?
  Where do I mark a breakpoint so that I can follow the creation of an
 index
  to file index.c for example?

 You have to start up your psql or other client run SELECT
 pg_backend_pid();
 and attach to that process in the debugger. It sounds like you've
 connected to
 the postmaster which doesn't actually do any of the work, it just forks
 other
 backends.

 --
   Gregory Stark
   EnterpriseDB  http://www.enterprisedb.com




-- 
Pedro Belmino.

# Ciência da Computação - UNIFOR
# [EMAIL PROTECTED]



Re: [HACKERS] Debugger

2007-10-19 Thread Pedro Belmino
Excuse me,
My previous email, I had a problem formatting of my text. So it is not
understandable.
Correcting:
Pinged the following steps in the console:
1. Pinged the command postgres to start.
2. Joined in psql.
3. Typed the following command to get the id of the process:
SELECT pg_backend_pid();
4. Tried to attach the id of the process to the debugger and gave the error:
Unable to open socket file: target process not responding or HotSpot VM not
loaded

2007/10/19, Pedro Belmino [EMAIL PROTECTED]:

 I am using linux.
 1. Inicializei the postgres the console by running. / Postgres.
 2. Joined in psql through console and simulated. / Psql
 3. Pg_backend_pid swirled SELECT () to get the id of the process;
 4. In ide tried to use that process to attach the debugger but gives the
 following error message:
 Unable to open file socket: target process not responding HotSpot VM or
 not loaded

 Thank,
 2007/10/19, Gregory Stark [EMAIL PROTECTED]:
 
 
  Pedro Belmino [EMAIL PROTECTED] writes:
 
   Hellow,
   I continue to have problems using the debugger, can not achieve any
   breakpoint that is outside the postmaster.c? Can anyone give me any
  hint?
   Where do I mark a breakpoint so that I can follow the creation of an
  index
   to file index.c for example?
 
  You have to start up your psql or other client run SELECT
  pg_backend_pid();
  and attach to that process in the debugger. It sounds like you've
  connected to
  the postmaster which doesn't actually do any of the work, it just forks
  other
  backends.
 
  --
Gregory Stark
EnterpriseDB   http://www.enterprisedb.com
 



 --
 Pedro Belmino.
 
 # Ciência da Computação - UNIFOR
 # [EMAIL PROTECTED]
 




-- 
Pedro Belmino.

# Ciência da Computação - UNIFOR
# [EMAIL PROTECTED]



Re: [HACKERS] Debugger

2007-10-19 Thread Gregory Stark

Pedro Belmino [EMAIL PROTECTED] writes:

 Hellow,
 I continue to have problems using the debugger, can not achieve any
 breakpoint that is outside the postmaster.c? Can anyone give me any hint?
 Where do I mark a breakpoint so that I can follow the creation of an index
 to file index.c for example?

You have to start up your psql or other client run SELECT pg_backend_pid();
and attach to that process in the debugger. It sounds like you've connected to
the postmaster which doesn't actually do any of the work, it just forks other
backends.

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [HACKERS] Debugger

2007-10-19 Thread Alexey Klyukin
PostgreSQL consists of multiple processes, launched by postmaster, make
sure you are debugging the right one. After connecting to a database
with your favorite client (i.e. psql) you can use ps (if you have a
unix-like system) or a task manager to determine a pid of postgres
process and then attach to that process with a debugger.

Pedro Belmino wrote:
 Hellow,
 I continue to have problems using the debugger, can not achieve any
 breakpoint that is outside the postmaster.c? Can anyone give me any hint?
 Where do I mark a breakpoint so that I can follow the creation of an index
 to file index.c for example?
 Thank,
 
 -- 
 Pedro Belmino.
 
 # Ciência da Computação - UNIFOR
 # [EMAIL PROTECTED]
 

-- 
Alexey Klyukin http://www.commandprompt.com/
The PostgreSQL Company - Command Prompt, Inc.


---(end of broadcast)---
TIP 6: explain analyze is your friend


[HACKERS] Debugger

2007-10-19 Thread Pedro Belmino
Hellow,
I continue to have problems using the debugger, can not achieve any
breakpoint that is outside the postmaster.c? Can anyone give me any hint?
Where do I mark a breakpoint so that I can follow the creation of an index
to file index.c for example?
Thank,

-- 
Pedro Belmino.

# Ciência da Computação - UNIFOR
# [EMAIL PROTECTED]



[HACKERS] debugger

2007-10-19 Thread Pedro Belmino
Hellow,
I continue to have problems using the debugger, can not achieve any
breakpoint that is outside the postmaster.c? Can anyone give me any hint?
Where do I mark a breakpoint so that I can follow the creation of an index
to file index.c for example?
Thank,
-- 
Pedro Belmino.

# Ciência da Computação - UNIFOR
# [EMAIL PROTECTED]



Re: [HACKERS] Debugger

2007-10-19 Thread Tom Lane
Pedro Belmino [EMAIL PROTECTED] writes:
 I continue to have problems using the debugger, can not achieve any
 breakpoint that is outside the postmaster.c? Can anyone give me any hint?
 Where do I mark a breakpoint so that I can follow the creation of an index
 to file index.c for example?

Sounds to me like you attached the debugger to the wrong process.
Start a session, find out the backend's PID, then attach to that.

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] Debugger

2007-09-20 Thread Hannes Eder

Peter Eisentraut schrieb:

Pedro Belmino wrote:
  

I am with a problem. When I am using debugger, breakpoints that they
are inside of main function (stop the execution in the marked point)
but when breakpoint is marked in another archive (index.c for
example) breakpoint does not function (the execution in the point
does not stop), because this happens?



There is a fork() happen between the main function and what you are 
probably looking for break at.  You need to attach to the session 
process after it forks, not to the main postmaster process.


  

If you just want a single backend, and entering sql commands to the
backend prompt is enough for you, you should consider using the
command line argument --single DATABASE for debugging.

see also:

http://developer.postgresql.org/pgdocs/postgres/app-postgres.html

-Hannes


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


[HACKERS] Debugger

2007-09-19 Thread Pedro Belmino
Hello,
I am with a problem. When I am using debugger, breakpoints that they are
inside of main function (stop the execution in the marked point) but when
breakpoint is marked in another archive (index.c for example) breakpoint
does not function (the execution in the point does not stop), because this
happens?

Thanks,
Pedro Belmino.


Re: [HACKERS] Debugger

2007-09-19 Thread Peter Eisentraut
Pedro Belmino wrote:
 I am with a problem. When I am using debugger, breakpoints that they
 are inside of main function (stop the execution in the marked point)
 but when breakpoint is marked in another archive (index.c for
 example) breakpoint does not function (the execution in the point
 does not stop), because this happens?

There is a fork() happen between the main function and what you are 
probably looking for break at.  You need to attach to the session 
process after it forks, not to the main postmaster process.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq