Closed
Bug 910863
Opened 12 years ago
Closed 12 years ago
Find some way to disable the slow script dialog while in a debugger
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(1 file, 1 obsolete file)
|
1.77 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
I recently made the slow script dialog more consistent and sane (in bug 901364). It now triggers more reliably (which is good!), but it also seems to appear more when debugging the browser under GDB. This is super annoying, and often confusing ("how come the behavior changes when I poke at the values for more than a few seconds?").
It seems like we should find some way to disarm the watchdog while the program is halted in a debugger. Does anyone know of a way to do this?
Comment 1•12 years ago
|
||
One of the things that I've had to do every time I've created a new profile for my debug builds has been to set the pref to not show the slow script dialog.
Comment 2•12 years ago
|
||
Yeah, same here.
If we can detect this automatically, that would be pretty awesome. ;)
| Assignee | ||
Comment 3•12 years ago
|
||
glandium, do we have any way to reliably detect if a debugger is attached?
Flags: needinfo?(mh+mozilla)
Comment 4•12 years ago
|
||
(In reply to comment #3)
> glandium, do we have any way to reliably detect if a debugger is attached?
Does something like this work? <http://blog.tildis.net/2008-08-10/detecting-if-gdb-is-attached/>
Windows has IsDebuggerPresent() for this purpose.
| Assignee | ||
Comment 5•12 years ago
|
||
Looks like nsIDebug2 has an IsDebuggerAttached, with implementations for windows and mac. I'll try using that, and file a bug on getting a linux implementation.
Comment 6•12 years ago
|
||
I actually looked at this for e10s. In e10s mode we will probably kill child processes that don't respond in a certain timeframe, which could of course happen if somebody attaches a debugger to them. On windows doing this check is quite easy, there is CheckRemoteDebuggerPresent. On Linux it might be possible to parse /proc/pid/status and look at the TracerPid entry. (I actually looked at the Linux source, but there seems to be no good way to get this value). On Linux there is also something like a event interface, where you can get messages when a debugger is attached. I have no idea about mac.
| Assignee | ||
Updated•12 years ago
|
Flags: needinfo?(mh+mozilla)
Comment 7•12 years ago
|
||
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #4)
> (In reply to comment #3)
> > glandium, do we have any way to reliably detect if a debugger is attached?
>
> Does something like this work?
> <http://blog.tildis.net/2008-08-10/detecting-if-gdb-is-attached/>
The problem with that approach is that it's racy: something else might attempt to ptrace at the wrong moment. That something else might be the crash reporter... Also, on the long run, there are going to be alternatives to ptrace on linux that allow a process to be traced by several other processes at the same time.
It feels to me the most reliable way would be to have gdb declare itself by flipping a bool value in mozglue when it attaches.
Comment 8•12 years ago
|
||
Ah yes, the /proc/self/status parsing would work.
| Assignee | ||
Comment 9•12 years ago
|
||
This appears to work. Flagging mrbkap for the XPConnect aspect, and glandium
on the usage of GetIsDebuggerEnabled here.
Attachment #797574 -
Flags: review?(mrbkap)
Attachment #797574 -
Flags: review?(mh+mozilla)
Comment 10•12 years ago
|
||
Comment on attachment 797574 [details] [diff] [review]
Skip firing the operation callback if a debugger is attached. v1
Review of attachment 797574 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/xpconnect/src/XPCJSRuntime.cpp
@@ +1187,5 @@
> if (manager->IsRuntimeActive() &&
> manager->TimeSinceLastRuntimeStateChange() >= PRTime(PR_USEC_PER_SEC))
> {
> + bool debuggerAttached = false;
> +#ifdef DEBUG
Why limit to debug builds? I, for one, almost always debug opt builds.
Attachment #797574 -
Flags: review?(mh+mozilla) → review+
| Assignee | ||
Comment 11•12 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #10)
> Comment on attachment 797574 [details] [diff] [review]
> Skip firing the operation callback if a debugger is attached. v1
>
> Review of attachment 797574 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: js/xpconnect/src/XPCJSRuntime.cpp
> @@ +1187,5 @@
> > if (manager->IsRuntimeActive() &&
> > manager->TimeSinceLastRuntimeStateChange() >= PRTime(PR_USEC_PER_SEC))
> > {
> > + bool debuggerAttached = false;
> > +#ifdef DEBUG
>
> Why limit to debug builds? I, for one, almost always debug opt builds.
Hm, I was trying to avoid the do_GetService call on opt builds, but I guess this only matters at the point where we're already stalling out, at which point it's pretty much amortized. I'll fix that.
| Assignee | ||
Comment 12•12 years ago
|
||
Attachment #797582 -
Flags: review?(mrbkap)
Updated•12 years ago
|
Attachment #797582 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Comment 13•12 years ago
|
||
Updated•12 years ago
|
Attachment #797574 -
Flags: review?(mrbkap)
| Assignee | ||
Updated•12 years ago
|
Attachment #797574 -
Attachment is obsolete: true
Comment 14•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Updated•12 years ago
|
Assignee: nobody → bobbyholley+bmo
You need to log in
before you can comment on or make changes to this bug.
Description
•