aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-11-20 17:32:18 -0800
committerRuss Cox <rsc@golang.org>2008-11-20 17:32:18 -0800
commit67addd4e11f147125952b0d4b50c1ed2563129e9 (patch)
treee96b789dcf10a35bece45394915ee1cb372a9cfb /src/runtime/runtime.c
parentec913c42b3d1a0a7f380aee5c1ce597f0d2f0f07 (diff)
downloadgo-67addd4e11f147125952b0d4b50c1ed2563129e9.tar.xz
symbol table changes
* add gotype string to symbol table * fill in gotype in 6l for known funcs/vars * print gotype with nm -t * load symbol and pc/ln tables into memory at magic address 0x99<<32. * add sys.symdat() to retrieve raw bytes of symbol table and pc/ln table. most of this should be considered experimental and subject to change. R=r DELTA=157 (128 added, 0 deleted, 29 changed) OCL=19746 CL=19750
Diffstat (limited to 'src/runtime/runtime.c')
-rw-r--r--src/runtime/runtime.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 5dd4336e79..0a72b146ba 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -743,3 +743,34 @@ algarray[3] =
// { pointerhash, pointerequal, pointerprint, pointercopy }, // 2
{ memhash, memequal, memprint, memcopy }, // 2 - treat pointers as ints
};
+
+
+// Return a pointer to a byte array containing the symbol table segment.
+//
+// NOTE(rsc): I expect that we will clean up both the method of getting
+// at the symbol table and the exact format of the symbol table at some
+// point in the future. It probably needs to be better integrated with
+// the type strings table too. This is just a quick way to get started
+// and figure out what we want from/can do with it.
+void
+sys·symdat(Array *symtab, Array *pclntab)
+{
+ Array *a;
+ int32 *v;
+
+ v = (int32*)(0x99LL<<32); /* known to 6l */
+
+ a = mal(sizeof *a);
+ a->nel = v[0];
+ a->cap = a->nel;
+ a->array = (byte*)&v[2];
+ symtab = a;
+ FLUSH(&symtab);
+
+ a = mal(sizeof *a);
+ a->nel = v[1];
+ a->cap = a->nel;
+ a->array = (byte*)&v[2] + v[0];
+ pclntab = a;
+ FLUSH(&pclntab);
+}