1 /* go-caller.c -- runtime.Caller and runtime.FuncForPC for Go.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 /* Implement runtime.Caller. */
11 #include "go-string.h"
13 /* The values returned by runtime.Caller. */
18 struct __go_string file
;
23 /* Implement runtime.Caller. */
25 struct caller_ret
Caller (int n
) asm ("libgo_runtime.runtime.Caller");
28 Caller (int n
__attribute__ ((unused
)))
30 struct caller_ret ret
;
32 /* A proper implementation needs to dig through the debugging
34 ret
.pc
= (uint64_t) (uintptr_t) __builtin_return_address (0);
35 ret
.file
.__data
= NULL
;
36 ret
.file
.__length
= 0;
43 /* Implement runtime.FuncForPC. */
45 void *FuncForPC (uintptr_t) asm ("libgo_runtime.runtime.FuncForPC");
48 FuncForPC(uintptr_t pc
__attribute__ ((unused
)))