changeset 45:01bbf3f6f966

Cleanups
author daveb
date Mon, 02 Aug 2010 14:44:12 +0930
parents 2b9329ed0f0e
children ad3ba55ae57b
files .hgignore builder.d doodle/core/backtrace.d doodle/main/prog/doodler.d options
diffstat 5 files changed, 10 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Aug 01 02:06:14 2010 +0930
+++ b/.hgignore	Mon Aug 02 14:44:12 2010 +0930
@@ -0,0 +1,1 @@
+configure.d.deps
--- a/builder.d	Sun Aug 01 02:06:14 2010 +0930
+++ b/builder.d	Mon Aug 02 14:44:12 2010 +0930
@@ -511,7 +511,7 @@
         writefln("Object    %s", mPath);
         scope cmd = new StringFormatter;
 
-        cmd.format("dmd -c -g");
+        cmd.format("dmd -c");
         foreach (path; Global.bundlePaths) {
             cmd.format(" -I", path);
         }
--- a/doodle/core/backtrace.d	Sun Aug 01 02:06:14 2010 +0930
+++ b/doodle/core/backtrace.d	Mon Aug 02 14:44:12 2010 +0930
@@ -27,17 +27,17 @@
     import std.demangle;
     import std.algorithm;
 
-    immutable int EI_NIDENT = 16;
+    immutable int EI_NIDENT  = 16;
 
     immutable int SHT_SYMTAB = 2;
     immutable int SHT_STRTAB = 3;
 
-    immutable int STT_FUNC = 2;
+    immutable int STT_FUNC   = 2;
 
     alias ushort Elf32_Half;
-    alias uint Elf32_Word;
-    alias uint Elf32_Addr;
-    alias uint Elf32_Off;
+    alias uint   Elf32_Word;
+    alias uint   Elf32_Addr;
+    alias uint   Elf32_Off;
     alias ushort Elf32_Section;
 
     struct Elf32_Ehdr {
@@ -93,40 +93,6 @@
         void * end_address() { return address + size; }
     };
 
-    // Linear traversal
-    Symbol lin_lookup(Symbol[] symbols, void * addr) {
-        foreach(s; symbols) {
-            if (addr >= s.address && addr < s.end_address) {
-                return s;
-            }
-        }
-        throw new Exception("Symbol not found");
-    }
-
-    // Bisection
-    Symbol bi_lookup(Symbol[] symbols, void * addr, int depth = 1) {
-        if (symbols.length == 0 ||
-            addr < symbols[0].address ||
-            addr >= symbols[$-1].end_address)
-        {
-            throw new Exception("Symbol not found");
-        }
-        else if (symbols.length == 1) {
-            //writefln("Depth: %s", depth);
-            return symbols[0];
-        }
-        else {
-            int i = symbols.length / 2;
-
-            if (addr < symbols[i].address) {
-                return bi_lookup(symbols[0..i], addr, depth + 1);
-            }
-            else {
-                return bi_lookup(symbols[i..$], addr, depth + 1);
-            }
-        }
-    }
-
     // Newton-Raphson
     Symbol nr_lookup(Symbol[] symbols, void * addr, int depth = 0) {
         if (symbols.length == 0 ||
@@ -136,7 +102,6 @@
             throw new Exception("Symbol not found");
         }
         else if (symbols.length == 1) {
-            //writefln("Depth: %s", depth);
             return symbols[0];
         }
         else {
@@ -144,13 +109,7 @@
             void * end_addr = symbols[$-1].end_address;
 
             int i = ((addr - begin_addr) * symbols.length) / (end_addr - begin_addr);
-            if (!(depth % 2) && i < symbols.length - 1) { ++i; }
-
-            /*
-               writefln("depth %s, index %s, size %s, left %s, right %s",
-               depth, i, symbols.length, (addr - begin_addr), (end_addr - addr));
-               writefln("depth %s, factor %s, length %s", depth, f, symbols.length);
-             */
+            if (!(depth % 2) && i < symbols.length - 1) { ++i; }        // Some wiggle to force convergence
 
             if (addr < symbols[i].address) {
                 return nr_lookup(symbols[0..i], addr, depth + 1);
--- a/doodle/main/prog/doodler.d	Sun Aug 01 02:06:14 2010 +0930
+++ b/doodle/main/prog/doodler.d	Mon Aug 02 14:44:12 2010 +0930
@@ -1,6 +1,7 @@
 private {
     import doodle.core.backtrace;
     import doodle.core.logging;
+    import doodle.core.backtrace;
 
     import doodle.dia.tool_layer;
     import doodle.dia.standard_tools;
--- a/options	Sun Aug 01 02:06:14 2010 +0930
+++ b/options	Mon Aug 02 14:44:12 2010 +0930
@@ -3,3 +3,4 @@
 -L-ldl
 -w
 -wi
+-g