Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Detecting a segfault in dmd itself

Johan Engelen edited this pageJun 3, 2016 ·3 revisions

Segfault filtering

One way to do it is this, which has the advantage of providing dmd's output before segfaulting:

#!/bin/sh# arguments to dmdDMDARGS="-debug -g ..."OUTPUT=$(gdb --batch -ex"run$DMDARGS" -ex'bt 30' dmd2>&1)echo"$OUTPUT"| egrep -q"in dwarf_typidx .+ at backend/dwarf\.c"# adapt for your needs, use fgrep if you don't need regexpsreturn$?

OS X (lldb)

#!/bin/sh# arguments to dmdDMDARGS="-debug -g ..."OUTPUT=$(lldb --batch -o"run$DMDARGS" -k'bt 30' -k'quit' -o'quit' dmd2>&1)echo"$OUTPUT"| egrep -q"in dwarf_typidx .+ at backend/dwarf\.c"# adapt for your needs, use fgrep if you don't need regexpsexit$?

Detect just any segfault

A simpler, but less detailed way, is to do this:

#!/bin/bashdmd ...args...# Segfaulting programs will likely return an error code of 139.if [$?-eq 139 ];thenexit 0elseexit 1fi

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp