Month: August 2016

dwarf is a too old and too inaccurate protocol to representing source code

dwarf is a too old and too inaccurate protocol to representing source code, i compile the following c code by gcc 5.2.0 and linked it by binutils 2.25

int testVarFunc() {
	int var1 = 1980;
	for (int y = 0; y < var1; y++) {
		int var2 = var1 + y*y;
	}
	int var4 = 2204;
	for (int y2 = 0; y2 < var4; y2++) {
		int var3 = var1 + y2*y2;
	}
	int var5 = 1234;
	var5 = var1*var4;
	return var5;
}

Then i use objdump 2.25 to disassemble it, the c source code line information is too in accurate, and i didn’t use turn on any gcc optimization. As you can see the below disassembly, the testVarFunc() appeared twice.

int testVarFunc() {
 1602903:       55                      push   %ebp
 1602904:       89 e5                   mov    %esp,%ebp
 1602906:       83 ec 20                sub    $0x20,%esp
        int var1 = 1980;
 1602909:       c7 45 f4 bc 07 00 00    movl   $0x7bc,-0xc(%ebp)
        for (int y = 0; y < var1; y++) {
 1602910:       c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%ebp)
 1602917:       8b 45 fc                mov    -0x4(%ebp),%eax
 160291a:       3b 45 f4                cmp    -0xc(%ebp),%eax
 160291d:       7d 16                   jge    1602935 <_Z11testVarFuncv+0x32>
                int var2 = var1 + y*y;
 160291f:       8b 45 fc                mov    -0x4(%ebp),%eax
 1602922:       0f af 45 fc             imul   -0x4(%ebp),%eax
 1602926:       89 c2                   mov    %eax,%edx
 1602928:       8b 45 f4                mov    -0xc(%ebp),%eax
 160292b:       01 d0                   add    %edx,%eax
 160292d:       89 45 f0                mov    %eax,-0x10(%ebp)
        }
}

int testVarFunc() {
        int var1 = 1980;
        for (int y = 0; y < var1; y++) {
 1602930:       ff 45 fc                incl   -0x4(%ebp)
 1602933:       eb e2                   jmp    1602917 <_Z11testVarFuncv+0x14>
                int var2 = var1 + y*y;
        }
        int var4 = 2204;
 1602935:       c7 45 ec 9c 08 00 00    movl   $0x89c,-0x14(%ebp)
        for (int y2 = 0; y2 < var4; y2++) {
 160293c:       c7 45 f8 00 00 00 00    movl   $0x0,-0x8(%ebp)
 1602943:       8b 45 f8                mov    -0x8(%ebp),%eax
 1602946:       3b 45 ec                cmp    -0x14(%ebp),%eax
 1602949:       7d 16                   jge    1602961 <_Z11testVarFuncv+0x5e>
                int var3 = var1 + y2*y2;
 160294b:       8b 45 f8                mov    -0x8(%ebp),%eax
 160294e:       0f af 45 f8             imul   -0x8(%ebp),%eax
 1602952:       89 c2                   mov    %eax,%edx
 1602954:       8b 45 f4                mov    -0xc(%ebp),%eax
 1602957:       01 d0                   add    %edx,%eax
 1602959:       89 45 e8                mov    %eax,-0x18(%ebp)
        int var1 = 1980;
        for (int y = 0; y < var1; y++) {
                int var2 = var1 + y*y;
        }
        int var4 = 2204;
        for (int y2 = 0; y2 < var4; y2++) {
 160295c:       ff 45 f8                incl   -0x8(%ebp)
160295f:       eb e2                   jmp    1602943 <_Z11testVarFuncv+0x40>
                int var3 = var1 + y2*y2;
        }
        int var5 = 1234;
 1602961:       c7 45 e4 d2 04 00 00    movl   $0x4d2,-0x1c(%ebp)
        var5 = var1*var4;
 1602968:       8b 45 f4                mov    -0xc(%ebp),%eax
 160296b:       0f af 45 ec             imul   -0x14(%ebp),%eax
 160296f:       89 45 e4                mov    %eax,-0x1c(%ebp)
        return var5;
 1602972:       8b 45 e4                mov    -0x1c(%ebp),%eax
}
 1602975:       c9                      leave  
 1602976:       c3                      ret    

read count : 22

Quantr plan

Here is my quantr plan, the first stage is to make all three components running. They are:
1. Quantr-server which manage the logic, start/top/pause/logging/monitoring
2. Quantr-sharppoint server, which is a high performance sharppoint gateway
3. Quantr, which is a management console, language compiler

quantr plan

Because i am doing quant development for a big corp, so these three parts are pretty much ready, below are the screenshots.

superalgo gui 1 superalgo gui 2

The next step is to draft the quantr language, i think in hong kong not many people have experimence to design a new computer language, but it doesn’t matter, i believe we are close to doing it. I will hold a dinner for every 2-3 weeks, lets everybody sit down and present their idea for the language. We probably can draft out all syntax in first 1-2 months. If you are interested to join, write you contact here¬†https://docs.google.com/spreadsheets/d/1k1gWhVagY5D8xC0m9EaniZxnbxzcrWeK5lETPHW_G5I/edit?usp=sharing¬†, i will call you to come out and discuss.

read count : 8

Dtrace inspired me

Reading a Dtrace book in library made me suddenly remember, awk-like language syntax is very suitable for quantitive programming language, so i write down the first draft of my quant language based on the syntax of dtrace.

dtrace_5973_1024

dtrace_5970_1024

dtrace_5972_1024

dtrace_5971_1024

dtrace_5970_1024

read count : 30

ELF-dependency-walker is a tool to view the dependencies of an ELF object/executable

ELF-dependency-walker is a tool to view the dependencies of an ELF object/executable, you can use it to analyst what libraries is an ELF depending to. If you are doing operating system development and trying to port a library from linux to your os, first thing you know is that you need to know how deep of that library is depending to. It is complete open source and free to use. Just download it from https://sourceforge.net/projects/elf-dependency-walker/ and run it by

java -jar elf-dependency-walker-XXX.jar

elf1

elf2

read count : 176