Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
06e96b9a
Commit
06e96b9a
authored
Nov 18, 2021
by
Umberto Baldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor debug command and use code from arguments, remove useless vars
parent
83942801
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
cli/debug/debug.go
cli/debug/debug.go
+8
-16
No files found.
cli/debug/debug.go
View file @
06e96b9a
...
...
@@ -35,14 +35,12 @@ import (
)
var
(
fqbn
string
fqbn
arguments
.
Fqbn
port
arguments
.
Port
verbose
bool
verify
bool
interpreter
string
importDir
string
printInfo
bool
programmer
string
programmer
arguments
.
Programmer
tr
=
i18n
.
Tr
)
...
...
@@ -54,18 +52,12 @@ func NewCommand() *cobra.Command {
Long
:
tr
(
"Debug Arduino sketches. (this command opens an interactive gdb session)"
),
Example
:
" "
+
os
.
Args
[
0
]
+
" debug -b arduino:samd:mkr1000 -P atmel_ice /home/user/Arduino/MySketch"
,
Args
:
cobra
.
MaximumNArgs
(
1
),
Run
:
run
,
Run
:
run
DebugCommand
,
}
debugCommand
.
Flags
()
.
StringVarP
(
&
fqbn
,
"fqbn"
,
"b"
,
""
,
tr
(
"Fully Qualified Board Name, e.g.: arduino:avr:uno"
))
debugCommand
.
RegisterFlagCompletionFunc
(
"fqbn"
,
func
(
cmd
*
cobra
.
Command
,
args
[]
string
,
toComplete
string
)
([]
string
,
cobra
.
ShellCompDirective
)
{
return
arguments
.
GetInstalledBoards
(),
cobra
.
ShellCompDirectiveDefault
})
fqbn
.
AddToCommand
(
debugCommand
)
port
.
AddToCommand
(
debugCommand
)
debugCommand
.
Flags
()
.
StringVarP
(
&
programmer
,
"programmer"
,
"P"
,
""
,
tr
(
"Programmer to use for debugging"
))
debugCommand
.
RegisterFlagCompletionFunc
(
"programmer"
,
func
(
cmd
*
cobra
.
Command
,
args
[]
string
,
toComplete
string
)
([]
string
,
cobra
.
ShellCompDirective
)
{
return
arguments
.
GetInstalledProgrammers
(),
cobra
.
ShellCompDirectiveDefault
})
programmer
.
AddToCommand
(
debugCommand
)
debugCommand
.
Flags
()
.
StringVar
(
&
interpreter
,
"interpreter"
,
"console"
,
tr
(
"Debug interpreter e.g.: %s"
,
"console, mi, mi1, mi2, mi3"
))
debugCommand
.
Flags
()
.
StringVarP
(
&
importDir
,
"input-dir"
,
""
,
""
,
tr
(
"Directory containing binaries for debug."
))
debugCommand
.
Flags
()
.
BoolVarP
(
&
printInfo
,
"info"
,
"I"
,
false
,
tr
(
"Show metadata about the debug session instead of starting the debugger."
))
...
...
@@ -73,7 +65,7 @@ func NewCommand() *cobra.Command {
return
debugCommand
}
func
run
(
command
*
cobra
.
Command
,
args
[]
string
)
{
func
run
DebugCommand
(
command
*
cobra
.
Command
,
args
[]
string
)
{
instance
:=
instance
.
CreateAndInit
()
path
:=
""
...
...
@@ -87,12 +79,12 @@ func run(command *cobra.Command, args []string) {
debugConfigRequested
:=
&
dbg
.
DebugConfigRequest
{
Instance
:
instance
,
Fqbn
:
fqbn
,
Fqbn
:
fqbn
.
String
()
,
SketchPath
:
sketchPath
.
String
(),
Port
:
discoveryPort
.
ToRPC
(),
Interpreter
:
interpreter
,
ImportDir
:
importDir
,
Programmer
:
programmer
,
Programmer
:
programmer
.
String
()
,
}
if
printInfo
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment