From 48693a2c501b73d533bbb628790ae826dc31baf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisend=C3=B6rfer?= Date: Mon, 22 Mar 2021 15:17:01 +0100 Subject: [PATCH] updates --- delve/stackannotate.star | 11 +---------- stack-traces.md | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/delve/stackannotate.star b/delve/stackannotate.star index d5e38ec..406e259 100644 --- a/delve/stackannotate.star +++ b/delve/stackannotate.star @@ -1,8 +1,4 @@ -# TODO -# Get stack lo from goroutine -# Use the stacktrace API to unwind the stack and get annotations - -word_size = 8 # 64bit +word_size = 8 # 64bit only for now def get_reg(name): for req in registers().Regs: @@ -143,10 +139,5 @@ def command_stackannotate(): ]) print(ascii_table(rows)) - #g = getg() - #for f in stacktrace(g.goid, 128, True).Locations: - #print(f) - #break - def main(): dlv_command("config alias stackannotate sa") diff --git a/stack-traces.md b/stack-traces.md index cb4d7b6..6165e4e 100644 --- a/stack-traces.md +++ b/stack-traces.md @@ -46,9 +46,9 @@ The next step is to find the program counters of all the callers of the current ### Real Example -Looking at pretty pictures can be good way to get a high level understanding of the stack, but it has its limits. Sometimes you need to look at the raw bits & bytes in order to get a full understanding. If you're not interested in that, feel free to skip ahead to the next section. +Looking at pretty pictures can be a good way to get a high level understanding of the stack, but it has its limits. Sometimes you need to look at the raw bits & bytes in order to get a full understanding. If you're not interested in that, feel free to skip ahead to the next section. -To take a look at the stack, we'll use [delve](https://github.com/go-delve/delve) which is a wonderful debugger for Go. In order to inspect the stack I wrote a script called [stackannotate.star](./delve/stackannotate.star) that can used to print the annotated stack for a simple [example program](examples/stackannotate/main.go) as can be seen below: +To take a look at the stack, we'll use [delve](https://github.com/go-delve/delve) which is a wonderful debugger for Go. In order to inspect the stack, I wrote a script called [stackannotate.star](./delve/stackannotate.star) that can used to print the annotated stack for a simple [example program](examples/stackannotate/main.go): ``` $ dlv debug ./examples/stackannotate/main.go