implement automatic crash reporting & retracer
Open, Needs TriagePublic

Description

A la apport+whoopsie+errors.ubuntu

crash reporting possibly needs writing from scratch in Go. Or maybe use what fedora uses, although it probably isn't meant to work with multiple different entities (distros) at the same time

key concern is getting this x-distro so we can at some point gobble up all crashes regardless of distro

sitter created this task.Jun 9 2016, 10:37 AM

get drkonqi to upload coredump and a kde distro-agnostic service to retrace that and compile useful data on it

sitter added a comment.EditedNov 15 2017, 11:38 AM
  • ubuntu uses apport+whoopsie+daisy
  • fedora uses abrt (this seems to have no remote part at all and is basically a fancier systemd-coredump)
  • opensuse simply uses systemd-coredump

We currently do not have anything by default as Martin Floeser suggested not having anything would be better from a performance POV as systemd-coredump for example can take quite a long time catching kwin crashes.

Canonical's thing still needs checking out but as it stands right now Google's breakpad might actually be the last terrible as it basically wants us to write all the rigging, which is probably needed anyway given the desire to have multi-distro retracing capabilities, so not starting with pre-conceived notions is somewaht of a boon. Also it has tooling to convert cores into minidump (wire format, same as windows uses) and vice versa. minidumps are fairly tiny as excess crap get stripped away. Server side they can be turned back into cores so one could retrace them through gdb (there is also specific retracing software for the minidumps but that requires its own set of symbol dumping). A tricky bit is that we'd need system context which isn't in the minidump. Namely all packages of all the files in the dump with their versions so one can then find the relevant symbols on the server. This particular bit actually may make Canonical's software superior if it has a generic enough understanding of the context in addition to the core (context needs to be providable xdistro). Also, given it has a webui (albeit not a terrribly fast one) it may already be nicer as with breakpad we have to build this or find third party solutions (of which I haven't encountered any)

Blob to build breakpad through cmake (not portable and does obsurd amounts of network IO):

include(ExternalProject)
ExternalProject_Add(depot_tools
    PREFIX "${CMAKE_CURRENT_BINARY_DIR}/depot_tools"
    GIT_REPOSITORY https://chromium.googlesource.com/chromium/tools/depot_tools.git
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
)

set(DEPOT "${CMAKE_CURRENT_BINARY_DIR}/depot_tools/src/depot_tools")

ExternalProject_Add(breakpad
    PREFIX "${CMAKE_CURRENT_BINARY_DIR}/breakpad"
    DEPENDS depot_tools
    DOWNLOAD_COMMAND ${DEPOT}/fetch breakpad || true
    DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/breakpad/fetch/"
    CONFIGURE_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/breakpad/fetch/src/configure"
    INSTALL_COMMAND ""
)
add_library(breakpad::breakpad STATIC IMPORTED)
set_property(TARGET breakpad::breakpad
    PROPERTY
        IMPORTED_LOCATION
        ${CMAKE_CURRENT_BINARY_DIR}/breakpad/src/breakpad-build/src/client/linux/libbreakpad_client.a)
set_target_properties(breakpad::breakpad
    PROPERTIES
    IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/breakpad/src/breakpad-build/src/client/linux/libbreakpad_client.a
    IMPORTED_LINK_INTERFACE_LIBRARIES "pthread"
    INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/breakpad/fetch/src/src)

kcrash.cpp additions (doesn't actually cascade the two handlers, simply installs breakpad as only handler)

#include <client/linux/handler/exception_handler.h>

static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
void* context, bool succeeded) {
  printf("Dump path: %s\n", descriptor.path());
  return succeeded;
}

struct Breakpadding
{
    Breakpadding()
        : descriptor("/tmp")
        , handler(descriptor, NULL, dumpCallback, NULL, true, -1)
    {
    }

    google_breakpad::MinidumpDescriptor descriptor;
    google_breakpad::ExceptionHandler handler;
};
Q_GLOBAL_STATIC(Breakpadding, s_breakpadding)

void KCrash::initialize()
{
    s_breakpadding->descriptor;
    return;
    .....

See https://github.com/google/breakpad/blob/master/docs/linux_starter_guide.md for info on how to dump symbols, stackwalk the minidump etc.