Bug 59154

Summary: /proc/pid/status and /proc/pid/stat don't reflect an attached debugger
Product: [Retired] Red Hat Linux Reporter: harry.heinisch
Component: gdbAssignee: Elena Zannoni <ezannoni>
Status: CLOSED NOTABUG QA Contact: Beth Uptagrafft <bhu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: bhu, cagney
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-25 20:04:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Comments after looking at some source code none

Description harry.heinisch 2002-01-31 21:08:09 UTC
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:
Always

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 21:15:11 UTC
Created attachment 44178 [details]
Comments after looking at some source code

Comment 2 Beth Uptagrafft 2002-02-11 19:10:21 UTC
This behavior also happens on 7.2 x86.

Comment 4 Elena Zannoni 2003-08-25 20:04:37 UTC
Not related to RHL/RHEL. This is an old gdb bug from GES.