Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Languages and Scripting
Showing results for 
Search instead for 
Did you mean: 

gdb errors attaching to a process


gdb errors attaching to a process

HP gurus:


I am having trouble attaching to a process in gdb. I have tried several

things to solve the problem, with no luck. I also searched through the

archives and found no past discussions about my problem. I am hoping

someone here can help.


I am running on a PA-RISC machine (a C3600 WS) using HP-UX 10.20.

The compiler I am using is g++ version2.7.2.2, and I am using gdb

version 4.16. I believe I compiled all the code correctly - I used the

"-g3 -O0 (that's -Ohhhh zero)" flags during my compile. The application

I am trying to test is three "levels" - an outer wrapper level, an

intermediate level, and a low-level kernel. I have tested the kernel

code in gdb with no problems. When I compiled everything and then

tried to attach to it, I get problems.


Assuming my Application program is named "foo" and its process

number is "1234", I have tried:

  > gdb foo

      (gdb) attach 1234


  > gdb foo 1234


  > gdb foo

      (gdb) attach 1234 foo


  > gdb

      (gdb) attach 1234 foo


With the exception of the last example (which is even worse), I get

an error:

  warning: reading register r3: I/O error

  0x1307578 in _read_sys ()


If I do a stack backtrace, I get:

  #0 0x1307578 in _read_sys ()

  #1 0x12f6410 in _read ()

When you look at the stack backtrace, it "hangs" and I

have to do a <CTRL-C> to get back a gdb prompt. I can

do "directory" commands and set break points, but when

I do a "continue", nothing happens. I eventually have to

do a <CTRL-C> to get the gdb prompt back, and the stack

backtrace is the same as above (i.e.. nothing seems to be



If I do a:

  > gdb foo

      (gdb) run

This seems to work fine - I can see the Application initializing

and interacting with the database. Once it's up and waiting

for some work to do, however, is when I want to attach to



Just for grins, I wrote a small program outside our Application

environment and tried to attach to it. I did not get the error

mentioned above, but I did get "permission" problems. When

I did the attach, I got back "ptrace: permission denied". I did

some Google searches and understand this a little; however,

most of the solutions were Linux based. I could not equate

most of the answers to HP-UX 10.20. Anyway, I did this just

for fun, but I would like to make some progress on the problem



Any ideas why I cannot seem to attach to a running process?


Thanks for the help.




Jeff Kolodziej




Dennis Handly
Acclaimed Contributor

Re: gdb errors attaching to a process (10.20)

I think you are way out of luck, 10.20 isn't supported and very old.

And the gdb you're using? isn't HP's wdb.


You may want to try debugging this on a more recent, supported OS version, 11.31.


Re: gdb errors attaching to a process (10.20)

Thanks for the reply and the advice. OK, your reply is not



Unfortunately, I am constrained with the current system

we have. There is no realistic option to use newer

hardware/software/tools, so I will search for an

alternative solution.


I assigned kudos - thanks again for the input.