~$ dlv exec terraform -- init Type 'help'for list of commands. (dlv) funcs discovery.*Get github.com/hashicorp/terraform/plugin/discovery.(*ProviderInstaller).Get
(dlv) l > github.com/hashicorp/terraform/terraform.loadProviderSchemas() /home/runsisi/workingcopy/src/hcl/terraform/terraform/schemas.go:95 (PC: 0xfe5fd0) 90: } 91: 92: func loadProviderSchemas(schemas map[string]*ProviderSchema, config *configs.Config, state *states.State, components contextComponentFactory) tfdiags.Diagnostics { 93: var diags tfdiags.Diagnostics 94: => 95: ensure := func(typeName string) { 96: if _, exists := schemas[typeName]; exists { 97: return 98: } 99: 100: log.Printf("[TRACE] LoadSchemas: retrieving schema for provider type %q", typeName) (dlv) b 96 Breakpoint 2 set at 0x103372f for github.com/hashicorp/terraform/terraform.loadProviderSchemas.func1() /home/runsisi/workingcopy/src/hcl/terraform/terraform/schemas.go:96 (dlv) cond 2 typeName == "linode" (dlv) bp Breakpoint unrecovered-panic at 0x432bf0 for runtime.fatalpanic() /usr/lib/go-1.12/src/runtime/panic.go:690 (0) print runtime.curg._panic.arg Breakpoint 1 at 0xfe5f8b for github.com/hashicorp/terraform/terraform.loadProviderSchemas() /home/runsisi/workingcopy/src/hcl/terraform/terraform/schemas.go:92 (1) Breakpoint 2 at 0x103372f for github.com/hashicorp/terraform/terraform.loadProviderSchemas.func1() /home/runsisi/workingcopy/src/hcl/terraform/terraform/schemas.go:96 (0) cond typeName == "linode"
其他命令可以在交互终端中输入 help 进行查找:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
(dlv) help The following commands are available: args ------------------------ Print function arguments. break (alias: b) ------------ Sets a breakpoint. breakpoints (alias: bp) ----- Print out info for active breakpoints. call ------------------------ Resumes process, injecting a function call (EXPERIMENTAL!!!) clear ----------------------- Deletes breakpoint. ... (dlv) help funcs Print list of functions.
funcs [<regex>]
If regex is specified only the functions matching it will be returned.
~$ gdb terraform GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty"for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration"for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type"help". Type "apropos word" to search for commands related to "word"... Reading symbols from terraform...sdone. Loading Go Runtime support. (gdb) set args init (gdb) info functions discovery.*Get All functions matching regular expression "discovery.*Get":