Project

General

Profile

Bug #4048

Crash catcher: Debugger detection not reliable

Added by Dark Locq 3 months ago. Updated 3 months ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
General
Target version:
Start date:
08/28/2017
% Done:

0%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

I was told that the Linux version produces a crash.log in the same directory as openmw.log in Linux, and people keep asking me for crash.log when I report problems against the MacOS X version of the game, but it is not creating any crash.log files (at least not in that location). I've been playing since January, and have never seen this file appear.

History

#1 Updated by Miroslav Remák 3 months ago

Does OpenMW output "Installing crash catcher" on startup?

#2 Updated by Dark Locq 3 months ago

Log says "Running in a debugger, not installing crash catcher".

#3 Updated by Miroslav Remák 3 months ago

  • Subject changed from Mac version not creating crash.log to Crash catcher: Debugger detection not reliable
  • Status changed from New to Confirmed
  • Target version set to openmw-1.0

The debugger detection is faulty - it can't detect gdb (7.11.1) on my end (Linux), and in your case (MacOS) you get false positives.

#4 Updated by Miroslav Remák 3 months ago

Our detection mechanism currently opens a file at startup and checks its file descriptor number:

// gdb apparently opens FD(s) 3,4,5 (whereas a typical prog uses only stdin=0, stdout=1,stderr=2)
bool
is_debugger_attached(void)
{
    bool rc = false;
    FILE *fd = fopen("/tmp", "r");

    if (fileno(fd) > 5)
    {
        rc = true;
    }

    fclose(fd);
    return rc;
}

#5 Updated by Andrei Kortunov 3 months ago

Under Linux you can read "/proc/self/status" and check TracerPid field, under Windows you can use IsDebuggerPresent() and IsRemoveDebuggerPresent().
But I am not sure about MacOS and other operating systems, such as FreeBSD.

#6 Updated by Andrei Kortunov 3 months ago

According to this article you can check P_TRACED flag under MacOS:

info.kp_proc.p_flag & P_TRACED

#7 Updated by Andrei Kortunov 3 months ago

IsRemoveDebuggerPresent()

IsRemoteDebuggerPresent(), I mean.

#8 Updated by Dark Locq 3 months ago

If this means "you have to compile it yourself", that's not going to work for MacPorts or Homebrew users; even the dependencies for building OpenMW in MacOS X are themselves dependent on Apple's own Unix executables and libraries. I tried for a week to work through compiling OpenMW myself, and eventually just had to give up.

#9 Updated by scrawl . 3 months ago

If this means "you have to compile it yourself"

No, above are just suggestions that still need to be coded first.

I thought maybe we could use breakpad instead of our crashcatcher, to get crashlogs on windows too. Does anyone have any experience with it?

#10 Updated by scrawl . 3 months ago

I thought maybe we could use breakpad instead of our crashcatcher,

To get:
  • crashlogs on windows
  • improved debugger detection
  • no need to install GDB

Assuming it offers all of that (not completely sure)

#11 Updated by Alexei Dobrohotov 3 months ago

  • Operating system changed from MacOS to Other

#12 Updated by Chris Robinson 3 months ago

Breakpad seems to be rather confusing. It took a while to simply find the stand-alone source repository, as most links seemed to lead to their issue tracker and others referenced Chrome's source. It also doesn't seem to be in Debian's package manager. When I did find it, there wasn't much in the way of an API reference explaining how to use it.

If it can work just as well, I won't have much of an issue trying it out. However, one thing I really like about crashcatcher is that it provides the crash information at crash time... libraries, threads, stack traces, addresses, etc, all in plain text. It doesn't just dump to a (binary) file that has to later be decoded with other utilities to figure out what happened. Also it could be a problem if it relies on having the same executable to properly decode the minidump it generates (I don't know if it does, I haven't fully looked through on how to use it).

Also available in: Atom PDF