mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2026-06-20 16:45:26 +08:00
updates
This commit is contained in:
parent
6a34d89513
commit
48693a2c50
2 changed files with 3 additions and 12 deletions
|
|
@ -1,8 +1,4 @@
|
||||||
# TODO
|
word_size = 8 # 64bit only for now
|
||||||
# Get stack lo from goroutine
|
|
||||||
# Use the stacktrace API to unwind the stack and get annotations
|
|
||||||
|
|
||||||
word_size = 8 # 64bit
|
|
||||||
|
|
||||||
def get_reg(name):
|
def get_reg(name):
|
||||||
for req in registers().Regs:
|
for req in registers().Regs:
|
||||||
|
|
@ -143,10 +139,5 @@ def command_stackannotate():
|
||||||
])
|
])
|
||||||
print(ascii_table(rows))
|
print(ascii_table(rows))
|
||||||
|
|
||||||
#g = getg()
|
|
||||||
#for f in stacktrace(g.goid, 128, True).Locations:
|
|
||||||
#print(f)
|
|
||||||
#break
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
dlv_command("config alias stackannotate sa")
|
dlv_command("config alias stackannotate sa")
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ The next step is to find the program counters of all the callers of the current
|
||||||
|
|
||||||
### Real Example
|
### 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
|
$ dlv debug ./examples/stackannotate/main.go
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue