<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic gdb errors attaching to a process in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6354729#M496445</link>
    <description>&lt;P&gt;HP gurus:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble attaching to a process in gdb. I have tried several&lt;/P&gt;&lt;P&gt;things to solve the problem, with no luck. I also searched through the&lt;/P&gt;&lt;P&gt;archives and found no past discussions about my problem. I am hoping&lt;/P&gt;&lt;P&gt;someone here can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running on a PA-RISC machine (a C3600 WS) using HP-UX 10.20.&lt;/P&gt;&lt;P&gt;The compiler I am using is g++ version2.7.2.2, and I am using gdb&lt;/P&gt;&lt;P&gt;version 4.16. I believe I compiled all the code correctly - I used the&lt;/P&gt;&lt;P&gt;"-g3 -O0 (that's -Ohhhh zero)" flags during my compile. The application&lt;/P&gt;&lt;P&gt;I am trying to test is three "levels" - an outer wrapper level, an&lt;/P&gt;&lt;P&gt;intermediate level, and a low-level kernel. I have tested the kernel&lt;/P&gt;&lt;P&gt;code in gdb with no problems. When I compiled everything and then&lt;/P&gt;&lt;P&gt;tried to attach to it, I get problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming my Application program is named "foo" and its process&lt;/P&gt;&lt;P&gt;number is "1234", I have tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo 1234&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234 foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234 foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the exception of the last example (which is even worse), I get&lt;/P&gt;&lt;P&gt;an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp; warning: reading register r3: I/O error&lt;/P&gt;&lt;P&gt;&amp;nbsp; 0x1307578 in _read_sys ()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do a stack backtrace, I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp; #0 0x1307578 in _read_sys ()&lt;/P&gt;&lt;P&gt;&amp;nbsp; #1 0x12f6410 in _read ()&lt;/P&gt;&lt;P&gt;When you look at the stack backtrace, it "hangs" and I&lt;/P&gt;&lt;P&gt;have to do a &amp;lt;CTRL-C&amp;gt; to get back a gdb prompt. I can&lt;/P&gt;&lt;P&gt;do "directory" commands and set break points, but when&lt;/P&gt;&lt;P&gt;I do a "continue", nothing happens. I eventually have to&lt;/P&gt;&lt;P&gt;do a &amp;lt;CTRL-C&amp;gt; to get the gdb prompt back, and the stack&lt;/P&gt;&lt;P&gt;backtrace is the same as above (i.e.. nothing seems to be&lt;/P&gt;&lt;P&gt;running).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do a:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) run&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This seems to work fine - I can see the Application initializing&lt;/P&gt;&lt;P&gt;and interacting with the database. Once it's up and waiting&lt;/P&gt;&lt;P&gt;for some work to do, however, is when I want to attach to&lt;/P&gt;&lt;P&gt;it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for grins, I wrote a small program outside our Application&lt;/P&gt;&lt;P&gt;environment and tried to attach to it. I did not get the error&lt;/P&gt;&lt;P&gt;mentioned above, but I did get "permission" problems. When&lt;/P&gt;&lt;P&gt;I did the attach, I got back "ptrace: permission denied". I did&lt;/P&gt;&lt;P&gt;some Google searches and understand this a little; however,&lt;/P&gt;&lt;P&gt;most of the solutions were Linux based. I could not equate&lt;/P&gt;&lt;P&gt;most of the answers to HP-UX 10.20. Anyway, I did this just&lt;/P&gt;&lt;P&gt;for fun, but I would like to make some progress on the problem&lt;/P&gt;&lt;P&gt;above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why I cannot seem to attach to a running process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeff Kolodziej&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2014 17:31:41 GMT</pubDate>
    <dc:creator>jakolodziej</dc:creator>
    <dc:date>2014-01-28T17:31:41Z</dc:date>
    <item>
      <title>gdb errors attaching to a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6354729#M496445</link>
      <description>&lt;P&gt;HP gurus:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble attaching to a process in gdb. I have tried several&lt;/P&gt;&lt;P&gt;things to solve the problem, with no luck. I also searched through the&lt;/P&gt;&lt;P&gt;archives and found no past discussions about my problem. I am hoping&lt;/P&gt;&lt;P&gt;someone here can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running on a PA-RISC machine (a C3600 WS) using HP-UX 10.20.&lt;/P&gt;&lt;P&gt;The compiler I am using is g++ version2.7.2.2, and I am using gdb&lt;/P&gt;&lt;P&gt;version 4.16. I believe I compiled all the code correctly - I used the&lt;/P&gt;&lt;P&gt;"-g3 -O0 (that's -Ohhhh zero)" flags during my compile. The application&lt;/P&gt;&lt;P&gt;I am trying to test is three "levels" - an outer wrapper level, an&lt;/P&gt;&lt;P&gt;intermediate level, and a low-level kernel. I have tested the kernel&lt;/P&gt;&lt;P&gt;code in gdb with no problems. When I compiled everything and then&lt;/P&gt;&lt;P&gt;tried to attach to it, I get problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming my Application program is named "foo" and its process&lt;/P&gt;&lt;P&gt;number is "1234", I have tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo 1234&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234 foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) attach 1234 foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the exception of the last example (which is even worse), I get&lt;/P&gt;&lt;P&gt;an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp; warning: reading register r3: I/O error&lt;/P&gt;&lt;P&gt;&amp;nbsp; 0x1307578 in _read_sys ()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do a stack backtrace, I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp; #0 0x1307578 in _read_sys ()&lt;/P&gt;&lt;P&gt;&amp;nbsp; #1 0x12f6410 in _read ()&lt;/P&gt;&lt;P&gt;When you look at the stack backtrace, it "hangs" and I&lt;/P&gt;&lt;P&gt;have to do a &amp;lt;CTRL-C&amp;gt; to get back a gdb prompt. I can&lt;/P&gt;&lt;P&gt;do "directory" commands and set break points, but when&lt;/P&gt;&lt;P&gt;I do a "continue", nothing happens. I eventually have to&lt;/P&gt;&lt;P&gt;do a &amp;lt;CTRL-C&amp;gt; to get the gdb prompt back, and the stack&lt;/P&gt;&lt;P&gt;backtrace is the same as above (i.e.. nothing seems to be&lt;/P&gt;&lt;P&gt;running).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do a:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt; gdb foo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (gdb) run&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This seems to work fine - I can see the Application initializing&lt;/P&gt;&lt;P&gt;and interacting with the database. Once it's up and waiting&lt;/P&gt;&lt;P&gt;for some work to do, however, is when I want to attach to&lt;/P&gt;&lt;P&gt;it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for grins, I wrote a small program outside our Application&lt;/P&gt;&lt;P&gt;environment and tried to attach to it. I did not get the error&lt;/P&gt;&lt;P&gt;mentioned above, but I did get "permission" problems. When&lt;/P&gt;&lt;P&gt;I did the attach, I got back "ptrace: permission denied". I did&lt;/P&gt;&lt;P&gt;some Google searches and understand this a little; however,&lt;/P&gt;&lt;P&gt;most of the solutions were Linux based. I could not equate&lt;/P&gt;&lt;P&gt;most of the answers to HP-UX 10.20. Anyway, I did this just&lt;/P&gt;&lt;P&gt;for fun, but I would like to make some progress on the problem&lt;/P&gt;&lt;P&gt;above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why I cannot seem to attach to a running process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeff Kolodziej&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2014 17:31:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6354729#M496445</guid>
      <dc:creator>jakolodziej</dc:creator>
      <dc:date>2014-01-28T17:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: gdb errors attaching to a process (10.20)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6355229#M496446</link>
      <description>&lt;P&gt;I think you are way out of luck, 10.20 isn't supported and very old.&lt;/P&gt;&lt;P&gt;And the gdb you're using? isn't HP's wdb.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may want to try debugging this on a more recent, supported OS version, 11.31.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2014 05:08:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6355229#M496446</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2014-01-29T05:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: gdb errors attaching to a process (10.20)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6356393#M496447</link>
      <description>&lt;P&gt;Thanks for the reply and the advice. OK, your reply is not&lt;/P&gt;&lt;P&gt;unexpected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I am constrained with the current system&lt;/P&gt;&lt;P&gt;we have. There is no realistic option to use newer&lt;/P&gt;&lt;P&gt;hardware/software/tools, so I will search for an&lt;/P&gt;&lt;P&gt;alternative solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assigned kudos - thanks again for the input.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2014 20:23:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/gdb-errors-attaching-to-a-process/m-p/6356393#M496447</guid>
      <dc:creator>jakolodziej</dc:creator>
      <dc:date>2014-01-29T20:23:14Z</dc:date>
    </item>
  </channel>
</rss>

