summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-12-30 15:21:31 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-30 16:28:27 +0100
commitefdbd778c2188c81f097372f2ce3e9ef251f7933 (patch)
tree8e30dd4fa974034f385577fc821ae7a5fbe894a9
parentd84b96bddc458685ea407b4db5d56c75625d439c (diff)
downloadserenity-efdbd778c2188c81f097372f2ce3e9ef251f7933.zip
LibC: Set "assertion" coredump metadata in __assertion_failed()
-rw-r--r--Libraries/LibC/assert.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Libraries/LibC/assert.cpp b/Libraries/LibC/assert.cpp
index 9e84b22cd6..45b358639e 100644
--- a/Libraries/LibC/assert.cpp
+++ b/Libraries/LibC/assert.cpp
@@ -24,9 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <Kernel/API/Syscall.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/internals.h>
#include <unistd.h>
@@ -39,6 +41,13 @@ void __assertion_failed(const char* msg)
dbgprintf("USERSPACE(%d) ASSERTION FAILED: %s\n", getpid(), msg);
if (__stdio_is_initialized)
fprintf(stderr, "ASSERTION FAILED: %s\n", msg);
+
+ Syscall::SC_set_coredump_metadata_params params {
+ { "assertion", strlen("assertion") },
+ { msg, strlen(msg) },
+ };
+ syscall(SC_set_coredump_metadata, &params);
+
abort();
}
#endif