Skip to content

Instantly share code, notes, and snippets.

require 'formula'
class Binutils < Formula
homepage 'http://www.gnu.org/software/binutils/binutils.html'
url 'http://ftpmirror.gnu.org/binutils/binutils-2.23.tar.gz'
mirror 'http://ftp.gnu.org/gnu/binutils/binutils-2.23.tar.gz'
sha1 '470c388c97ac8d216de33fa397d7be9f96c3fe04'
option 'with-libiberty', 'Compile and install libiberty'
@awreece
awreece / error
Last active December 10, 2015 16:59
$ php test.php
Fatal error: Call to a member function get_string() on a non-object in /private/tmp/test.php on line 11
Program received signal SIGSEGV, Segmentation fault.
0x000000000040094d in main (argc=1, argv=0x7fffffffe088) at try_perf.c:85
85 inarray[i] = rand() % 50;
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64
(gdb) x/i $pc
=> 0x40094d <main+116>: mov %eax,(%rbx)
(gdb) x/a $rbx
0x7ffff75a9000: 0x3010102464c457f
@awreece
awreece / small.c
Last active December 11, 2015 00:09
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
uint32_t* inarray = (uint32_t*) malloc(1ULL<<22);
size_t i;
for (i = 0; i < (1ULL<<22); i++) {
narray[i] = rand() % 50;
Percent | Source code & Disassembly of a.out
------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 0000000000400869 <thread_scan>:
: size_t size;
: size_t* num_perfect_squares;
% pprof --list=thread_scan a.out a.out.prof
Using local file a.out.
Using local file a.out.prof.
Removing _L_unlock_16 from all stack traces.
ROUTINE ====================== thread_scan in /afs/andrew.cmu.edu/usr9/areece/15-418/profiling/try_perf.c
199 1087 Total samples (flat / cumulative)
. . 55: size_t size;
. . 56: size_t* num_perfect_squares;
. . 57: mutex_t * num_perfect_squares_lock;
. . 58: } thread_arg_t;
% pprof --disas=thread_scan a.out a.out.prof
Using local file a.out.
Using local file a.out.prof.
Removing _L_unlock_16 from all stack traces.
ROUTINE ====================== thread_scan
199 1087 samples (flat, cumulative) 103.4% of total
-------------------- .../andrew.cmu.edu/usr9/areece/15-418/profiling/try_perf.c
. . 60: void* thread_scan(void* void_arg) {
. . 400869: push %rbp
. . 40086a: mov %rsp,%rbp
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include/ -I/Users/areece/.opam/4.00.1+annot/lib/camlidl -D_THREAD_SAFE -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -m32 -MT generated_message_util.lo -MD -MP -MF .deps/generated_message_util.Tpo -c -o generated_message_util.lo `test -f 'google/protobuf/generated_message_util.cc' || echo './'`google/protobuf/generated_message_util.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include/ -I/Users/areece/.opam/4.00.1+annot/lib/camlidl -D_THREAD_SAFE -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -m32 -MT generated_message_util.lo -MD -MP -MF .deps/generated_message_util.Tpo -c google/protobuf/generated_message_util.cc -fno-common -DPIC -o .libs/generated_message_util.o
In file included from google/protobuf/generated_message_util.cc:37:0:
/usr/local/Cellar/gcc/4.7.2/gcc/lib/gcc/x86_64-apple-darwin12.2.1/4.7.2/../../../../include/c++/4.7.2/limits:1405:35: error: template argu
pretty: $(SRCS)
@# Check to make sure we have the proper version of indent.
$(if $(findstring GNU,$(shell indent --version 2>/dev/null)),, $(error Install GNU indent))
@echo "Running GNU indent on source files"
@# Note - If we have any typedefs, we need to explicitly tell indent
@# about our typedefs via
@# -T type_t
@indent \
-T word_entry_t \
g++ -I../include -I../src/traces -I/Users/areece/Developer/bap/ocaml4/VEX/pub -g -O2 -L/usr/local/lib -L/usr/local/lib/x86_64/ -o print-ir print-ir.o ir_printer.o /Users/areece/Developer/bap/ocaml4/libasmir/src/libasmir.a /Users/areece/Developer/bap/ocaml4/VEX/libvex.a -lbfd -ldl -lopcodes -lz -lpcre -liberty -lbfd
Undefined symbols for architecture x86_64:
"_libintl_dgettext", referenced from:
_parse_arm_disassembler_option in libopcodes.a(arm-dis.o)
_print_arm_disassembler_options in libopcodes.a(arm-dis.o)
_print_insn_coprocessor in libopcodes.a(arm-dis.o)
_bfd_elf_string_from_elf_section in libbfd.a(elf.o)
_bfd_elf_get_elf_syms in libbfd.a(elf.o)
__bfd_elf_setup_sections in libbfd.a(elf.o)
__bfd_elf_make_section_from_shdr in libbfd.a(elf.o)