Skip to content

Instantly share code, notes, and snippets.

View brendandahl's full-sized avatar

Brendan Dahl brendandahl

  • Google
  • San Francisco, CA
View GitHub Profile
change base_path and my_symbol
for lib in $(find base_path -name \*.a) ; do echo $lib ; nm $lib | grep -i my_symbol | grep -v " U " ; done
@brendandahl
brendandahl / cinnabar-to-gecko-dev.md
Last active August 10, 2016 18:58
Find gecko-dev sha from cinnabar sha by date

Replace ../gecko with path to your cinnabar gecko repo and da9da17db2c68140ad873d2701c3c05162ca8443 with your cinnabar sha

[positron]$ git log gecko/master --format="%h %ci" --max-count=1000 | grep "$(git -C ../gecko show -s --format=%ci da9da17db2c68140ad873d2701c3c05162ca8443)"
@brendandahl
brendandahl / Main.cpp
Last active July 8, 2016 23:09
Attempt at adding an observer before XRE_main runs
// in main.cpp
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
class nsBlahObserver final : public nsIObserver
{
public:
@brendandahl
brendandahl / positron_electron_notes.md
Created July 6, 2016 21:51
Notes from Integrating SpiderNode into Positron

First spider monkey context creation:

thread #1: tid = 0x7007eb, 0x0000000109aa8386 XUL`JSContext::init(this=0x0000000117fea000, maxBytes=33554432, maxNurseryBytes=16777216) + 22 at jscntxt.cpp:93, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000109aa8386 XUL`JSContext::init(this=0x0000000117fea000, maxBytes=33554432, maxNurseryBytes=16777216) + 22 at jscntxt.cpp:93
    frame #1: 0x0000000109aa8409 XUL`js::NewContext(maxBytes=33554432, maxNurseryBytes=16777216, parentRuntime=0x0000000000000000) + 73 at jscntxt.cpp:106
    frame #2: 0x00000001099fa9a8 XUL`JS_NewRuntime(maxbytes=33554432, maxNurseryBytes=16777216, parentRuntime=0x0000000000000000) + 200 at jsapi.cpp:457
  * frame #3: 0x00000001026eed79 XUL`mozilla::CycleCollectedJSRuntime::Initialize(this=0x0000000100763000, aParentRuntime=0x0000000000000000, aMaxBytes=33554432, aMaxNurseryBytes=16777216) + 185 at CycleCollectedJSRuntime.cpp:510
    frame #4: 0x0000000103b80093 XUL`XPCJSRuntime::Initialize(this=0x000000
script topsrcdir = "/Users/bdahl/projects/gecko"
command alias gk command source -s true "/Users/bdahl/projects/gecko/.lldbinit"
@brendandahl
brendandahl / print_on_android.cpp
Created February 17, 2016 19:16
Print to logcat on android.
#include <android/log.h>
__android_log_print(ANDROID_LOG_INFO, "ZZZ", "!!!!!!!!!!!!!!!!!!! HERE 1\n");
nsAutoCString url;
aPresContext->Document()->GetDocumentURI()->GetSpec(url);
printf("nsMediaQueryResultCacheKey::Matches [url = %s]\n", url.get());
nsAutoString autoString;
// mName is the atom
(*(entry->mFeature->mName))->ToString(autoString);
printf("nsMediaQueryResultCacheKey::Matches %s\n", NS_ConvertUTF16toUTF8(autoString).get());
@brendandahl
brendandahl / break.cpp
Created December 18, 2015 00:00
Set lldb breakpoint in cpp
__asm__("int3");
@brendandahl
brendandahl / gist:f0f952e27dc66bb61391
Created September 18, 2015 16:45
nsDocShellLoadTypes
LOAD_NORMAL: 1
LOAD_NORMAL_REPLACE: 800001
LOAD_NORMAL_EXTERNAL: 10000001
LOAD_HISTORY: 4
LOAD_NORMAL_BYPASS_CACHE: 1000001
LOAD_NORMAL_BYPASS_PROXY: 2000001
LOAD_NORMAL_BYPASS_PROXY_AND_CACHE: 3000001
LOAD_NORMAL_ALLOW_MIXED_CONTENT: 21000001
LOAD_RELOAD_NORMAL: 2
LOAD_RELOAD_BYPASS_CACHE: 1000002