Skip to content

Instantly share code, notes, and snippets.

@crimsonwoods
crimsonwoods / setup_jamruby.sh
Created September 14, 2013 01:46
build script for jamruby.
#!/bin/bash
GITHUB_URL_JAMRUBY=git@github.com:jamruby/jamruby.git
GITHUB_URL_JAMRUBYAPP=git@github.com:jamruby/JamrubyApp.git
GITHUB_URL_MRUBY=https://github.com/mruby/mruby.git
JAMRUBY_MRUBY_BUILD_CONFIG=jamruby_build_config.rb
UPDATE_REPOSITORIES=0
ANDROID_TARGET_JAMRUBY=`cat jamruby/project.properties | grep -P "target\s*\=\s*android\-" | sed -e "s/target\=\(.*\)/\\1/"`
ANDROID_TARGET_JAMRUBYAPP=`cat JamrubyApp/project.properties | grep -P "target\s*\=\s*android\-" | sed -e "s/target\=\(.*\)/\\1/"`
@crimsonwoods
crimsonwoods / mruby-uv-fix-memory-corruption.patch
Last active December 20, 2015 01:09
This patch fixes memory corruption in mruby-uv.
diff --git a/src/mrb_uv.c b/src/mrb_uv.c
index b7d16d2..46d2620 100644
--- a/src/mrb_uv.c
+++ b/src/mrb_uv.c
@@ -1230,7 +1230,8 @@ _uv_getaddrinfo_cb(uv_getaddrinfo_t* req, int status, struct addrinfo* res)
c = mrb_class_new_instance(mrb, 0, NULL, _class_uv_addrinfo);
mrb_iv_set(mrb, c, mrb_intern(mrb, "context"), mrb_obj_value(
Data_Wrap_Struct(mrb, mrb->object_class,
- &uv_addrinfo_type, (void*) res)));
+ &uv_addrinfo_type, (void*) addr)));
@crimsonwoods
crimsonwoods / mruby_leak_detection.patch
Created April 13, 2013 16:47
a patch to add memory leak detection.
diff --git src/state.c src/state.c
index 0b6c755..528143e 100644
--- src/state.c
+++ src/state.c
@@ -55,17 +55,124 @@ filename(char const *path)
}
return path;
}
+
+typedef struct alloc_header_t {
@crimsonwoods
crimsonwoods / mruby_alloc_debug.patch
Created April 13, 2013 08:43
A path to add debug information to mruby memory allocation.
diff --git build_config.rb build_config.rb
index 424f9d0..890173a 100644
--- build_config.rb
+++ build_config.rb
@@ -59,7 +59,8 @@ MRuby::Build.new do |conf|
# C compiler settings
- # conf.cc do |cc|
+ conf.cc do |cc|
ALLOCATE: 0x24f9010 1216 state.c 29 (mrb_open_allocf)
ALLOCATE: 0x24f94e0 49200 gc.c 306 (add_heap)
ALLOCATE: 0x2505520 64 symbol.c 35 (kh_init_n2s_size)
ALLOCATE: 0x2505570 8 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x2505590 512 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x25057a0 64 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x25057f0 64 class.c 18 (kh_init_mt_size)
ALLOCATE: 0x2505840 8 class.c 18 (kh_alloc_mt)
ALLOCATE: 0x2505860 64 class.c 18 (kh_alloc_mt)
ALLOCATE: 0x25058b0 256 class.c 18 (kh_alloc_mt)
@crimsonwoods
crimsonwoods / AndroidSecurityOverView.md
Created February 18, 2013 08:34
Android Security Overviewの邦訳

Android Security Overview

原文 : http://source.android.com/tech/security/index.html

背景

Androidプラットフォームを構成する主要なブロックは下記です。

  • Device Hardware
  • Android OS
  • Androidアプリケーションランタイム
@crimsonwoods
crimsonwoods / backtrace.c
Created November 21, 2012 03:16
A sample code for ARM processor to handle the abnormal termination and display backtrace.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <endian.h>
@crimsonwoods
crimsonwoods / mcat.c
Created October 15, 2012 04:32
cat '/proc/xxx/maps' file
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
typedef struct app_args_t {
pid_t pid;
int is_dev_only;
@crimsonwoods
crimsonwoods / hmidump.c
Created October 12, 2012 08:07
dump HMI
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <dlfcn.h>
#include <unistd.h>
#include <stdint.h>
struct hw_module_t;
struct hw_device_t;
@crimsonwoods
crimsonwoods / odexsigfix.c
Created October 3, 2012 05:54
fix signature field into ODEX file.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
typedef struct app_args_t {
char const * orig_odex;