Closed
Bug 789817
Opened 14 years ago
Closed 14 years ago
DebugUtil::BeingDebugged() always fails on NetBSD/OpenBSD
Categories
(Core :: IPC, defect)
Tracking
()
RESOLVED
FIXED
mozilla18
People
(Reporter: jbeich, Unassigned)
Details
Attachments
(1 file)
|
2.57 KB,
patch
|
cjones
:
review+
gaston
:
feedback+
|
Details | Diff | Splinter Review |
No description provided.
- KERN_PROC always fails on OpenBSD due to unspecified 5th/6th level name.
- kp_proc.p_flag on NetBSD doesn't provide P_TRACED flag (tried with gdb)
Attachment #659585 -
Flags: feedback?(landry)
Comment 2•14 years ago
|
||
Comment on attachment 659585 [details] [diff] [review]
fix, same style as in bug 789693
Works for me with the following simplified testcase :
#include <sys/param.h>
#include <sys/sysctl.h>
#include <stdio.h>
#define KP_FLAGS p_flag
#define KINFO_PROC struct kinfo_proc
int main()
{
int being_debugged=-1;
int mib[] = {
CTL_KERN,
KERN_PROC,
KERN_PROC_PID,
getpid(),
sizeof(KINFO_PROC),
1,
};
KINFO_PROC info;
size_t info_size = sizeof(info);
int sysctl_result = sysctl(mib, 6, &info, &info_size, NULL, 0);
if (sysctl_result != 0) {
return -1;
}
being_debugged = (info.KP_FLAGS & P_TRACED) != 0;
printf ("being_debugged:%s\n",( being_debugged ? "yes" : "no"));
}
$./t
being_debugged:no
$gdb t
(gdb) r
Starting program: /tmp/t
being_debugged:yes
Attachment #659585 -
Flags: feedback?(landry) → feedback+
Comment 3•14 years ago
|
||
In NetBSD the PSL_TRACED flag has moved from struct proc:p_flag to struct proc:p_slflag. Unfortunately this was not reflected in an update to struct kinfo_proc2, which we will fix.
However, this means there is no easy way to get at it now in a sane way.
Generic comment: please do not use struct kinfo_proc on NetBSD, if possible (use kinfo_proc2 instead).
Comment on attachment 659585 [details] [diff] [review]
fix, same style as in bug 789693
Chris, do you like the new style or prefer to keep existing one? With old style it'd look similar to attachment 659485 [details].
Attachment #659585 -
Flags: review?(jones.chris.g)
Attachment #659585 -
Flags: review?(jones.chris.g) → review+
(In reply to Martin Husemann from comment #3)
> In NetBSD the PSL_TRACED flag has moved from struct proc:p_flag to struct
> proc:p_slflag. Unfortunately this was not reflected in an update to struct
> kinfo_proc2, which we will fix.
and the code would need to be modified like this?
+#elif defined(OS_NETBSD) && __NetBSD_Version__ >= POST_NEWLOCK3
+#define P_TRACED PSL_TRACED
+#define KP_FLAGS p_slflag
#else
#define KP_FLAGS p_flag
As that's yet to happen I'm pushing kinfo_proc2:p_flag on NetBSD for now.
Keywords: checkin-needed
Comment 7•14 years ago
|
||
(In reply to Jan Beich from comment #6)
> As that's yet to happen I'm pushing kinfo_proc2:p_flag on NetBSD for now.
I was wrong - the PSL_TRACED flag is properly propagated to the P_TRACED flag in kinfo_proc2.p_flag.
So the change is fine.
Comment 8•14 years ago
|
||
Comment 9•14 years ago
|
||
Flags: in-testsuite-
Keywords: checkin-needed
Comment 10•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in
before you can comment on or make changes to this bug.
Description
•