Skip to content

Instantly share code, notes, and snippets.

Davide Italiano dcci

Block or report user

Report or block dcci

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:97720a0d23169afda8afcebd1c85a38d
./lldb-mi
(gdb)
-unknown-command
^error,msg="Driver. Received command '-unknown-command'. It was not handled. Command 'unknown-command' not in Command Factory"
(gdb)
-file-exec-and-symbols ./a.out
^done
(gdb)
=library-loaded,id="/Users/davide/work/llvm-project-20170507/build-py/bin/a.out",target-name="/Users/davide/work/llvm-project-20170507/build-py/bin/a.out",host-name="/Users/davide/work/llvm-project-20170507/build-py/bin/a.out",symbols-loaded="1",symbols-path="/Users/davide/work/llvm-project-20170507/build-py/bin/a.out.dSYM/Contents/Resources/DWARF/a.out",loaded_addr="-",size="4096"
-break-insert -f main
View gist:94a4936a227d9c7627b91ae9575b7b68
$ cat mi-driver.py
from builtins import bytes
import subprocess
import sys
from subprocess import Popen
from subprocess import PIPE
def sendCmd(process, command):
View gist:bfd7b76bb3f63bbe7c067085224545f1
dtdebugger:omega davide$ DYLD_LIBRARY_PATH=/usr/lib/swift lldb -- /Users/davide/Downloads/Xcode.app/Contents/Developer/usr/bin/xctest -XCTest IntegrationTests.IntegrationTests/testKillContent /Users/davide/omega/omega/.build/x86_64-apple-macosx/debug/OmegaPackageTests.xctest
(lldb) target create "/Users/davide/Downloads/Xcode.app/Contents/Developer/usr/bin/xctest"
Current executable set to '/Users/davide/Downloads/Xcode.app/Contents/Developer/usr/bin/xctest' (x86_64).
(lldb) settings set -- target.run-args "-XCTest" "IntegrationTests.IntegrationTests/testKillContent" "/Users/davide/omega/omega/.build/x86_64-apple-macosx/debug/OmegaPackageTests.xctest"
(lldb) r
Process 27933 launched: '/Users/davide/Downloads/Xcode.app/Contents/Developer/usr/bin/xctest' (x86_64)
Test Suite 'Selected tests' started at 2019-02-11 13:11:30.525
Test Suite 'OmegaPackageTests.xctest' started at 2019-02-11 13:11:30.525
Test Suite 'IntegrationTests' started at 2019-02-11 13:11:30.525
Test Case '-[IntegrationTests.IntegrationTests te
@dcci
dcci / optout.c
Last active Nov 19, 2018
optimized out arguments
View optout.c
__attribute__((noinline))
int fn1 (long int x, long int y, long int z) {
int l = x * 2;
int q = y * z;
return l + q;
}
__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
View gist:6c881156fce549e5f67a781d359d9f0f
func f1() -> Int32 {
let x : Int32 = Int32.max
let y : Int32 = 42
return x + y
}
func f2(_ b : Bool) -> Int32 {
let verylarge : Int32 = Int32.max
View go home lldb, you're drunk.
davide@Davidinos-Mac-Pro ~/w/l/b/bin> ./clang ./pat.c -o pat -O1 -g
davide@Davidinos-Mac-Pro ~/w/l/b/bin> cat pat.c
int f(int x) {
asm("");
return 0;
}
__attribute__((noinline))
int g(int x) {
return x;
View reducing
Delta:
$ cat check-2.sh
#!/bin/bash
ulimit -t 3; ~/work/llvm/build-release/bin/opt -S $1 | ~/work/llvm/build-release/bin/lli
if ! test "$?" = "0"; then
exit 1
fi
View gist:bdfa0713a02ced182667aecea65730b9
# Python reference http://lldb.llvm.org/python-reference.html
import lldb
def main():
dbg = lldb.SBDebugger.Create()
target = dbg.CreateTarget("a.out")
if not target:
print("Can't create target!")
return 1
View gist:da05b9308cfa3ee860248adb83fc8bac
--- pat.diff 2018-03-12 14:53:39.000000000 -0700
+++ pat2.diff 2018-03-12 14:54:14.000000000 -0700
@@ -15,25 +15,25 @@
decl: var intField: Int for 'intField' usr=s:14swift_ide_test8Myclass1C8intFieldSivp
decl: init() for '' usr=s:14swift_ide_test8Myclass1CACycfc
decl: func f1() for 'f1' usr=s:14swift_ide_test2f1yyF
-decl: func f1() for 's1ins' usr=s:14swift_ide_test2f1yyF5s1insL_AA9Mystruct1Vvp
+decl: var s1ins: Mystruct1 for 's1ins' usr=s:14swift_ide_test2f1yyF5s1insL_AA9Mystruct1Vvp
type: Mystruct1 for 's1ins' mangled=$S14swift_ide_test9Mystruct1VD
type: Int for 'intField' mangled=$SSiD
@dcci
dcci / indprop.v
Created Mar 7, 2018
Inductively defined propositions in coq
View indprop.v
Inductive ev : nat -> Prop :=
| ev_0 : ev 0
| ev_SS : forall n : nat, ev n -> ev (S (S n)).
Theorem ev_4 : ev 4.
Proof.
apply ev_SS.
apply ev_SS.
apply ev_0.
You can’t perform that action at this time.