Skip to content

Instantly share code, notes, and snippets.

@pestophagous
Last active September 14, 2015 21:11
Show Gist options
  • Save pestophagous/7c42802b5c7eebfde100 to your computer and use it in GitHub Desktop.
Save pestophagous/7c42802b5c7eebfde100 to your computer and use it in GitHub Desktop.
gdb command file
#!/bin/bash
# ------- NOTE: this is ***NOT*** (not not not) a bash file. However, i added the bin/bash line to get better highlighting in emacs.
# note that INSERT of libgmalloc makes the app run SLOWER !!!
#set environment DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.B.dylib
# WATCHPOINT.
# (gdb) awatch -location m_extraActionTimeLimitUnitTracker
# Hardware access (read/write) watchpoint 4: *(int *) 4423742944
# it worked with awatch and watch
define pq
set $d=$arg0.d
printf "(Qt5 QString)0x%x length=%i: \"",&$arg0,$d->size
set $i=0
set $ca=(const char*)(((const char*)$d)+$d->offset)
while $i < ($d->size * 2)
set $c=$ca[$i++]
#if $c < 32 || $c > 127
# printf "\\u%04x", $c
#else
printf "%c" , (char)$c
#end
end
printf "\"\n"
end
set env MAC_ONLY_CALL_LEAKS_ON_EXIT 1
set env ACMECORP_OBTRUSIVE_DIAGNOSTIC_LOGGING 1
set env ACMECORP_BETA_STIMLIST_TESTING 1
set env ACMECORP_OBTRUSIVE_STIM_OUTLINES 1
set env MallocStackLogging 1
set environment MallocErrorAbort=1
set environment MallocCorruptionAbort=1
set environment MallocGuardEdges=1
set environment MallocPreScribble=1
set environment MallocScribble=1
set environment DYLD_PRINT_LIBRARIES=1
#set env NSDebugEnabled=YES
#set env NSZombieEnabled=YES
#set env NSAutoreleaseFreedObjectCheckEnabled=YES
#set env MallocStackLoggingNoCompact=YES
# *** -[CFDictionary release]: message sent to deallocated instance 0x652e280
# The question is where did I ever allocate that object. To find that I do:
#(gdb)
#(gdb) info malloc-history 0x652e280
#break malloc_error_break # no longer exists after i left os x 10.6 for a newer mac os?
break main
# see TOP OF THIS FILE FOR THIS:
#set environment DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.B.dylib
#set environment MallocCheckHeapStart=1850000
# 1000
# 100000
# 10000
#set environment MallocCheckHeapEach=8000
#800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment