Bug 59154 - /proc/pid/status and /proc/pid/stat don't reflect an attached debugger
/proc/pid/status and /proc/pid/stat don't reflect an attached debugger
Product: Red Hat Linux
Classification: Retired
Component: gdb (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Elena Zannoni
Beth Uptagrafft
Depends On:
  Show dependency treegraph
Reported: 2002-01-31 16:08 EST by harry.heinisch
Modified: 2007-04-18 12:39 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-25 16:04:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Comments after looking at some source code (1.36 KB, text/plain)
2002-01-31 16:15 EST, harry.heinisch
no flags Details

  None (edit)
Description harry.heinisch 2002-01-31 16:08:09 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
We attach gdb to a program, then we use another program to try and determine 
when/if the debugger is attached by reading the /proc/pid/status for the value 
of TracerPid and /proc/pid/stat for the value of "traced" in the flags. Neither 
one seems to be set, whereas it seems like it should be set if the program is 
being debugged. 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.run a program that lasts long enough for you to...
2.attach gdb to the program
3. cat /proc/pid/status and /proc/pid/stat to evaluate the TracerPid 
and "traced" bits  for the program (I think TracerPid is the 'new' mechanism 
for this, but we're checking both so we can span versions.)
Note: we were using a threaded program, but I checked all processes and all 
values for these bits were zero.  I haven't tried with a non-threaded program.

Actual Results:  TracerPid bit is 0 and so is the traced bit, so our tool 
assumes the debugger is not attached, when in fact it is attached.

Expected Results:  Recognition that the debugger was attached to the program.

Additional info:

We are running the beta1 which is 2.4.9-14a, but we have looked at sources for 
2.4.17. And basically it seems like /proc/pid/stat was not changed so that it 
would OR in the ptrace flag when it reports the process flags.  I'll put in 
more details about that as an attachment...
Comment 1 harry.heinisch 2002-01-31 16:15:11 EST
Created attachment 44178 [details]
Comments after looking at some source code
Comment 2 Beth Uptagrafft 2002-02-11 14:10:21 EST
This behavior also happens on 7.2 x86.
Comment 4 Elena Zannoni 2003-08-25 16:04:37 EDT
Not related to RHL/RHEL. This is an old gdb bug from GES.

Note You need to log in before you can comment on or make changes to this bug.