Skip to content

Instantly share code, notes, and snippets.

View jimblandy's full-sized avatar

Jim Blandy jimblandy

View GitHub Profile
import gdb
import mozilla.prettyprinters as prettyprinters
from mozilla.prettyprinters import ptr_pretty_printer, pretty_printer
prettyprinters.clear_module_printers(__name__)
@pretty_printer('js::analyze::SSAValue')
class SSAValuePrinter(object):
def __init__(self, value, cache):
self.value = value
@jimblandy
jimblandy / gist:4567915
Last active December 11, 2015 07:39
Patch to SpiderMonkey GDB support: define AggregateMap utility class.
# HG changeset patch
# Parent 07b885dd9d132c648f49eac357faa3e90e8741a8
diff --git a/js/src/gdb/mozilla/prettyprinters.py b/js/src/gdb/mozilla/prettyprinters.py
--- a/js/src/gdb/mozilla/prettyprinters.py
+++ b/js/src/gdb/mozilla/prettyprinters.py
@@ -312,6 +312,211 @@ class Pointer(object):
def summary(self):
raise NotImplementedError
@jimblandy
jimblandy / gist:4543764
Last active December 11, 2015 04:18
Operation callback testing API
triggerOperationCallback([delay])
Trigger an operation callback.
If 'delay' is given, it must be a positive integer; wait that many operation
callback opportunities to trigger the callback. (Note that delay counts only
work when we are running a body function from 'withOperationCallback'.)
withOperationCallback(body, [callback])
Call the function 'body', establishing the function 'callback' as the
operation callback while 'body' runs. Once 'body' completes, restore the
@jimblandy
jimblandy / transport-comment.patch
Created November 13, 2012 19:47
DebuggerTransport comment patch
# HG changeset patch
# Parent ac0d8052d26c75b44c5a25ea227c08d0446dc2a2
diff --git a/toolkit/devtools/debugger/dbg-transport.js b/toolkit/devtools/debugger/dbg-transport.js
--- a/toolkit/devtools/debugger/dbg-transport.js
+++ b/toolkit/devtools/debugger/dbg-transport.js
@@ -14,7 +14,7 @@ Cu.import("resource://gre/modules/NetUti
*
* @param aInput nsIInputStream
* The input stream.
@jimblandy
jimblandy / bump.c
Created November 1, 2012 18:58
Microbenchmark for bump allocators with guard pages or limit pointer checks
#define _GNU_SOURCE // for gregset_t indices
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <setjmp.h>
@jimblandy
jimblandy / aab.cpp.transcript
Created October 8, 2012 21:11
works for me!
play$ cat aab.cpp
void AAA();
void AAA(int);
void AAA2();
bool f(int *p, AAB obj);
play$ clang++ aab.cpp
aab.cpp:4:16: error: unknown type name 'AAB'
bool f(int *p, AAB obj);
^
1 error generated.
#!/usr/bin/env bash
# Like find, but automatically ignore Mercurial metadata and build trees
# Skip initial path arguments, so we can insert our magic at the start
# of the options.
paths=()
while case "${1--}" in (-* | !) false;; (*) true;; esac do
paths=("${paths[@]}" "$1")
shift
done