trepanning 0.1.6 → 1.93.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. data/COPYING +57 -0
  2. data/ChangeLog +585 -736
  3. data/NEWS +26 -12
  4. data/README.md +62 -0
  5. data/Rakefile +15 -9
  6. data/app/breakpoint.rb +11 -12
  7. data/app/complete.rb +14 -14
  8. data/app/core.rb +34 -30
  9. data/app/default.rb +8 -7
  10. data/app/markdown.rb +191 -0
  11. data/app/options.rb +104 -99
  12. data/app/run.rb +9 -1
  13. data/app/util.rb +7 -7
  14. data/bin/trepan +7 -7
  15. data/interface.rb +0 -4
  16. data/interface/user.rb +11 -11
  17. data/io/input.rb +13 -13
  18. data/lib/trepanning.rb +30 -29
  19. data/processor.rb +40 -40
  20. data/processor/command.rb +13 -9
  21. data/processor/command/alias.rb +21 -15
  22. data/processor/command/backtrace.rb +27 -19
  23. data/processor/command/break.rb +24 -21
  24. data/processor/command/complete.rb +5 -2
  25. data/processor/command/condition.rb +14 -9
  26. data/processor/command/debug.rb +8 -8
  27. data/processor/command/down.rb +6 -6
  28. data/processor/command/edit.rb +4 -0
  29. data/processor/command/eval.rb +2 -2
  30. data/processor/command/exit.rb +12 -9
  31. data/processor/command/finish.rb +25 -23
  32. data/processor/command/frame.rb +30 -26
  33. data/processor/command/help.rb +203 -185
  34. data/processor/command/help/{command.txt → command.md} +21 -18
  35. data/processor/command/help/examples.md +20 -0
  36. data/processor/command/help/filename.md +46 -0
  37. data/processor/command/help/location.md +34 -0
  38. data/processor/command/help/suffixes.md +19 -0
  39. data/processor/command/info.rb +6 -4
  40. data/processor/command/info_subcmd/breakpoints.rb +13 -13
  41. data/processor/command/info_subcmd/files.rb +35 -31
  42. data/processor/command/info_subcmd/frame.rb +82 -33
  43. data/processor/command/info_subcmd/macro.rb +1 -1
  44. data/processor/command/info_subcmd/program.rb +8 -5
  45. data/processor/command/info_subcmd/registers.rb +15 -13
  46. data/processor/command/kill.rb +23 -17
  47. data/processor/command/list.rb +63 -56
  48. data/processor/command/macro.rb +45 -28
  49. data/processor/command/next.rb +29 -23
  50. data/processor/command/pp.rb +11 -9
  51. data/processor/command/pr.rb +10 -8
  52. data/processor/command/ps.rb +5 -5
  53. data/processor/command/quit.rb +24 -17
  54. data/processor/command/raise.rb +6 -6
  55. data/processor/command/reload.rb +9 -2
  56. data/processor/command/reload_subcmd/command.rb +4 -4
  57. data/processor/command/restart.rb +9 -4
  58. data/processor/command/save.rb +9 -9
  59. data/processor/command/server.rb +18 -17
  60. data/processor/command/set.rb +8 -6
  61. data/processor/command/set_subcmd/confirm.rb +15 -2
  62. data/processor/command/set_subcmd/different.rb +7 -5
  63. data/processor/command/set_subcmd/highlight.rb +14 -3
  64. data/processor/command/set_subcmd/pc.rb +62 -0
  65. data/processor/command/set_subcmd/sp.rb +8 -2
  66. data/processor/command/shell.rb +25 -23
  67. data/processor/command/show.rb +9 -7
  68. data/processor/command/show_subcmd/confirm.rb +12 -1
  69. data/processor/command/show_subcmd/highlight.rb +13 -3
  70. data/processor/command/source.rb +27 -26
  71. data/processor/command/step.rb +52 -43
  72. data/processor/command/tbreak.rb +9 -4
  73. data/processor/command/unalias.rb +9 -7
  74. data/processor/command/undisplay.rb +11 -7
  75. data/processor/command/up.rb +18 -13
  76. data/processor/command/watchg.rb +20 -17
  77. data/processor/complete.rb +120 -0
  78. data/processor/default.rb +47 -43
  79. data/processor/list.rb +23 -6
  80. data/processor/load_cmds.rb +25 -105
  81. data/processor/location.rb +104 -96
  82. data/processor/mock.rb +12 -12
  83. data/processor/msg.rb +61 -52
  84. data/processor/validate.rb +36 -27
  85. data/test/data/fname-with-blank.right +0 -1
  86. data/test/data/trace-mingw.right +28 -0
  87. data/test/data/trace.right +0 -2
  88. data/test/functional/test-raise.rb +3 -0
  89. data/test/integration/helper.rb +16 -16
  90. data/test/integration/test-debugger-stop.rb +8 -2
  91. data/test/integration/test-quit.rb +16 -15
  92. data/test/integration/test-trace.rb +19 -10
  93. data/test/unit/cmd-helper.rb +4 -1
  94. data/test/unit/test-app-complete.rb +3 -1
  95. data/test/unit/test-app-options.rb +7 -1
  96. data/test/unit/test-app-run.rb +9 -1
  97. data/test/unit/test-cmd-alias.rb +1 -1
  98. data/test/unit/test-cmd-edit.rb +2 -0
  99. data/test/unit/test-cmd-help.rb +10 -5
  100. data/test/unit/test-cmd-parse_list_cmd.rb +3 -3
  101. data/test/unit/test-completion.rb +2 -2
  102. data/test/unit/test-proc-default.rb +34 -0
  103. data/trepanning.gemspec +15 -14
  104. metadata +70 -44
  105. data/README.textile +0 -50
  106. data/processor/command/help/examples.txt +0 -16
  107. data/processor/command/help/filename.txt +0 -40
  108. data/processor/command/help/location.txt +0 -37
  109. data/processor/command/help/suffixes.txt +0 -17
  110. data/processor/command/info_subcmd/registers_subcmd/dfp.rb +0 -28
  111. data/processor/command/info_subcmd/registers_subcmd/lfp.rb +0 -47
  112. data/processor/command/nocache.rb +0 -32
  113. data/processor/command/parsetree.rb +0 -56
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../command'
4
4
 
5
5
  class Trepan::Command::NextCommand < Trepan::Command
@@ -7,36 +7,42 @@ class Trepan::Command::NextCommand < Trepan::Command
7
7
  unless defined?(HELP)
8
8
  NAME = File.basename(__FILE__, '.rb')
9
9
  HELP = <<-HELP
10
- #{NAME}[+|=|-|<|>|!|<>] [EVENT-NAME...] [count]
10
+ **#{NAME}**[+|=|-|<|>|!|<>] [*event-name*...] [*count*]
11
11
 
12
12
  Step one statement ignoring steps into function calls at this level.
13
- Sometimes this is called 'step over'.
13
+ Sometimes this is called "step over".
14
14
 
15
- With an integer argument, perform '#{NAME}' that many times. However if
16
- an exception occurs at this level, or we 'return' or 'yield' or the
15
+ With an integer argument, perform `#{NAME}` that many times. However
16
+ if an exception occurs at this level, or we *return* or *yield* or the
17
17
  thread changes, we stop regardless of count.
18
18
 
19
- A suffix of '+' on the command or an alias to the command forces to
20
- move to another line, while a suffix of '-' does the opposite and
19
+ A suffix of "+" on the command or an alias to the command forces to
20
+ move to another line, while a suffix of "-" does the opposite and
21
21
  disables the requiring a move to a new line. If no suffix is given,
22
22
  the debugger setting 'different' determines this behavior.
23
23
 
24
- If no suffix is given, the debugger setting 'different'
25
- determines this behavior.
24
+ If no suffix is given, the debugger setting *different* determines
25
+ this behavior.
26
26
 
27
- Examples:
28
- #{NAME} # #{NAME} 1 event, *any* event
29
- #{NAME} 1 # same as above
30
- #{NAME}+ # same but force stopping on a new line
31
- #{NAME}= # same but force stopping on a new line a new frame added
32
- #{NAME}- # same but force stopping on a new line a new frame added
33
- #{NAME} 5/5+0 # same as above
34
- #{NAME} line # #{NAME} using only line events
35
- #{NAME} call # #{NAME} using only call call events
36
- #{NAME}<> # #{NAME} using call return events at this level or below
27
+ Examples:
28
+ ---------
29
+
30
+ #{NAME} # #{NAME} 1 event, *any* event
31
+ #{NAME} 1 # same as above
32
+ #{NAME}+ # same but force stopping on a new line
33
+ #{NAME}= # same but force stopping on a new line a new frame added
34
+ #{NAME}- # same but force stopping on a new line a new frame added
35
+ #{NAME} 5/5+0 # same as above
36
+ #{NAME} line # #{NAME} using only line events
37
+ #{NAME} call # #{NAME} using only call call events
38
+ #{NAME}<> # #{NAME} using call return events at this level or below
39
+
40
+ See also:
41
+ ---------
42
+ `step`, `continue`, `finish`, `set different`
37
43
  HELP
38
44
 
39
- ALIASES = %W(n #{NAME}+ #{NAME}- #{NAME}< #{NAME}> #{NAME}<> #{NAME}! n> n< n! n+ n-
45
+ ALIASES = %W(n #{NAME}+ #{NAME}- #{NAME}< #{NAME}> #{NAME}<> #{NAME}! n> n< n! n+ n-
40
46
  n<> n=)
41
47
  CATEGORY = 'running'
42
48
  # execution_set = ['Running']
@@ -54,15 +60,15 @@ Examples:
54
60
  else
55
61
  count_str = args[1]
56
62
  opts = {
57
- :msg_on_error =>
58
- "The '#{NAME}' command argument must eval to an integer. Got: %s" %
63
+ :msg_on_error =>
64
+ "The '#{NAME}' command argument must eval to an integer. Got: %s" %
59
65
  count_str,
60
66
  :min_value => 1
61
67
  }
62
68
  count = @proc.get_an_int(count_str, opts)
63
69
  return unless count
64
70
  # step 1 is core.step_count = 0 or "stop next event"
65
- step_count = count - 1
71
+ step_count = count - 1
66
72
  end
67
73
  @proc.next(step_count, opts)
68
74
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require 'rubygems'
4
4
  require 'pp'
5
5
  require_relative '../command'
@@ -7,27 +7,29 @@ class Trepan::Command::PPCommand < Trepan::Command
7
7
 
8
8
  unless defined?(HELP)
9
9
  NAME = File.basename(__FILE__, '.rb')
10
- HELP =
11
- "#{NAME} EXPRESSION
10
+ HELP = <<-HELP
11
+ **#{NAME}** *Ruby-expression*
12
12
 
13
- Prtty Print the value of the EXPRESSION. Variables accessible are
13
+ Prtty Print the value of the *expression*. Variables accessible are
14
14
  those of the environment of the selected stack frame, plus globals.
15
15
 
16
16
  If the length output string large, the first part of the value is
17
- shown and ... indicates it has been truncated.
17
+ shown and "..." indicates it has been truncated.
18
18
 
19
- See 'set max string' to change the string truncation limit.
20
- "
19
+ See also:
20
+ ---------
21
+ `set max string` to change the string truncation limit.
22
+ HELP
21
23
  CATEGORY = 'data'
22
24
  SHORT_HELP = 'pretty print expression truncating long output'
23
25
  end
24
-
26
+
25
27
  def run(args)
26
28
  obj = @proc.debug_eval(@proc.cmd_argstr)
27
29
  msg (obj.respond_to?(:pretty_inspect) ? obj.pretty_inspect : obj.inspect)
28
30
  end
29
31
  end
30
-
32
+
31
33
  if __FILE__ == $0
32
34
  require_relative '../mock'
33
35
  dbgr, cmd = MockDebugger::setup
@@ -1,32 +1,34 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../command'
4
4
  class Trepan::Command::PrCommand < Trepan::Command
5
5
 
6
6
  unless defined?(HELP)
7
7
  NAME = File.basename(__FILE__, '.rb')
8
8
  HELP = <<-HELP
9
- "#{NAME} EXPRESSION
9
+ **#{NAME}** *ruby-expression*
10
10
 
11
- Print the value of the EXPRESSION. Variables accessible are those of the
12
- environment of the selected stack frame, plus globals.
11
+ Print the value of the *expression*. Variables accessible are those of the
12
+ environment of the selected stack frame, plus globals.
13
13
 
14
14
  If the length output string large, the first part of the value is
15
- shown and ... indicates it has been truncated.
15
+ shown and "..." indicates it has been truncated.
16
16
 
17
- See 'set max string' to change the string truncation limit.
17
+ See also:
18
+ ---------
19
+ `set max string` to change the string truncation limit.
18
20
  HELP
19
21
 
20
22
  # ALIASES = %w(p)
21
23
  CATEGORY = 'data'
22
24
  SHORT_HELP = 'print expression truncating long output'
23
25
  end
24
-
26
+
25
27
  def run(args)
26
28
  @proc.eval_code(@proc.cmd_argstr, @proc.settings[:maxstring])
27
29
  end
28
30
  end
29
-
31
+
30
32
  if __FILE__ == $0
31
33
  require_relative '../mock'
32
34
  dbgr, cmd = MockDebugger::setup
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../command'
4
4
  require_relative '../eval'
5
5
  class Trepan::Command::PsCommand < Trepan::Command
@@ -7,16 +7,16 @@ class Trepan::Command::PsCommand < Trepan::Command
7
7
  unless defined?(HELP)
8
8
  NAME = File.basename(__FILE__, '.rb')
9
9
  HELP = <<-HELP
10
- #{NAME} ARRAY
10
+ **#{NAME}* *Ruby-array*
11
11
 
12
- Print the value of the ARRAY in columns and sorted.
12
+ Print the value of the *array* in columns and sorted.
13
13
  HELP
14
14
 
15
15
  CATEGORY = 'data'
16
16
  MIN_ARGS = 1 # Need least this many
17
17
  SHORT_HELP = 'Print array sorted and in columns'
18
18
  end
19
-
19
+
20
20
  def run(args)
21
21
  array = @proc.debug_eval(@proc.cmd_argstr, @proc.settings[:maxstring])
22
22
  # FIXME: should test for enumerable
@@ -27,7 +27,7 @@ Print the value of the ARRAY in columns and sorted.
27
27
  end
28
28
  end
29
29
  end
30
-
30
+
31
31
  if __FILE__ == $0
32
32
  require_relative '../mock'
33
33
  dbgr, cmd = MockDebugger::setup
@@ -1,27 +1,31 @@
1
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010-2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
2
+ require 'rbconfig'
2
3
  require_relative '../command'
3
4
  class Trepan::Command::QuitCommand < Trepan::Command
4
5
 
5
6
  unless defined?(HELP)
6
7
  NAME = File.basename(__FILE__, '.rb')
7
8
  HELP = <<-HELP
8
- #{NAME}[!] [unconditionally] [exit code]
9
+ **#{NAME}**[!] [**unconditionally**] [*exit-code*]
9
10
 
10
- gentle termination
11
+ Gentle termination.
11
12
 
12
- The program being debugged is exited via exit() which runs the Kernel
13
- at_exit finalizers. If a return code is given, that is the return code
14
- passed to exit() - presumably the return code that will be passed back
13
+ The program being debugged is exited via *exit()* which runs the Kernel
14
+ *at_exit* finalizers. If a return code is given, that is the return code
15
+ passed to *exit()*; presumably the return code that will be passed back
15
16
  to the OS. If no exit code is given, 0 is used.
16
17
 
17
- Examples:
18
- #{NAME} # quit prompting if we are interactive
19
- #{NAME} unconditionally # quit without prompting
20
- #{NAME}! # same as above
21
- #{NAME} 0 # same as "quit"
22
- #{NAME}! 1 # unconditional quit setting exit code 1
18
+ Examples:
19
+ ---------
20
+ #{NAME} # quit prompting if we are interactive
21
+ #{NAME} unconditionally # quit without prompting
22
+ #{NAME}! # same as above
23
+ #{NAME} 0 # same as "quit"
24
+ #{NAME}! 1 # unconditional quit setting exit code 1
23
25
 
24
- See also the commands "exit" and "kill".
26
+ See also:
27
+ ---------
28
+ `exit`, `kill`
25
29
  HELP
26
30
 
27
31
  ALIASES = %W(#{NAME}! q q!)
@@ -35,7 +39,10 @@ See also the commands "exit" and "kill".
35
39
 
36
40
  # This method runs the command
37
41
  def run(args)
38
- unconditional =
42
+ if RbConfig::CONFIG['target_os'].start_with?('mingw')
43
+ return @proc.commands['exit'].run(['exit', args])
44
+ end
45
+ unconditional =
39
46
  if args.size > 1 && args[-1] == 'unconditionally'
40
47
  args.shift
41
48
  true
@@ -48,7 +55,7 @@ See also the commands "exit" and "kill".
48
55
  msg('Quit not confirmed.')
49
56
  return
50
57
  end
51
-
58
+
52
59
  if (args.size > 1)
53
60
  if args[1] =~ /\d+/
54
61
  exitrc = args[1].to_i;
@@ -69,8 +76,8 @@ end
69
76
  if __FILE__ == $0
70
77
  require_relative '../mock'
71
78
  dbgr, cmd = MockDebugger::setup
72
- Process.fork { cmd.run([cmd.name]) } if
73
- Process.respond_to?(:fork)
79
+ Process.fork { cmd.run([cmd.name]) } if
80
+ Process.respond_to?(:fork)
74
81
  cmd.run([cmd.name, 'foo'])
75
82
  cmd.run([cmd.name, '5'])
76
83
  end
@@ -1,24 +1,24 @@
1
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010, 2015 Rocky Bernstein <rockyb@rubyforge.net>
2
2
  require_relative '../command'
3
3
  class Trepan::Command::RaiseCommand < Trepan::Command
4
4
 
5
5
  unless defined?(HELP)
6
6
  NAME = File.basename(__FILE__, '.rb')
7
7
  HELP = <<-HELP
8
- #{NAME} [exception-name]
8
+ **#{NAME}** [*exception-name*]
9
9
 
10
- Raise an EXCEPTION-NAME in the debugged program. If no exception name
11
- is given, raise RuntimeError.
10
+ Raise an *execption-name* in the debugged program. If no exception name
11
+ is given, raise `RuntimeError`.
12
12
  HELP
13
13
 
14
14
  CATEGORY = 'running'
15
15
  MAX_ARGS = 1 # Need at most this many
16
16
  SHORT_HELP = 'Raise an exception in the debugged program'
17
17
  end
18
-
18
+
19
19
  # This method runs the command
20
20
  def run(args)
21
- exception =
21
+ exception =
22
22
  if args.size > 1
23
23
  except_str = args[1..-1].join(' ')
24
24
  # Normally would need x.respond_to? && ..
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative 'base/submgr'
4
4
  require_relative '../../app/util'
5
5
 
@@ -7,10 +7,17 @@ class Trepan::Command::ReloadCommand < Trepan::SubcommandMgr
7
7
  Trepan::Util.suppress_warnings {
8
8
  NAME = File.basename(__FILE__, '.rb')
9
9
  ALIASES = %w(rel)
10
- HELP = 'Reload information'
11
10
  CATEGORY = 'data'
12
11
  NEED_STACK = false
13
12
  SHORT_HELP = 'Reload information'
13
+ HELP = <<-HELP
14
+ **#{NAME}** [*reload-subcommand*]
15
+
16
+ Reload debugger information after something has changed.
17
+ For example if you change the Ruby code for a debugger *quit*,
18
+ `reload command quit` will get the change seen inside the
19
+ currently-running debugger.
20
+ HELP
14
21
  }
15
22
 
16
23
  def initialize(proc)
@@ -1,15 +1,15 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../base/subcmd'
4
4
 
5
5
  class Trepan::Subcommand::ReloadCommand < Trepan::Subcommand
6
6
  unless defined?(HELP)
7
7
  Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
8
  HELP = <<-HELP
9
- reload command [file-or-directory ...]
9
+ **#{PREFIX.join(' ')}** [*file-or-directory* ...]
10
10
 
11
- Loads or reloads debugger commands. If no parameters are passed all
12
- commands are reloaded. If a parameters are passed each is expected to
11
+ Loads or reloads debugger commands. If no parameters are passed all
12
+ commands are reloaded. If a parameters are passed each is expected to
13
13
  be a either a Ruby file which implements a series of debugger
14
14
  commands by defining Trepan::Command classes, or a directory which contains
15
15
  files that implements debugger commands.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../command'
4
4
  require_relative '../../app/run'
5
5
  class Trepan::Command::RestartCommand < Trepan::Command
@@ -8,17 +8,22 @@ class Trepan::Command::RestartCommand < Trepan::Command
8
8
  NAME = File.basename(__FILE__, '.rb')
9
9
  ALIASES = %w(R run)
10
10
  HELP = <<-HELP
11
- #{NAME}
11
+ **#{NAME}**
12
12
 
13
13
  Restart debugger and program via an exec call. All state is lost, and
14
14
  new copy of the debugger is used.
15
+
16
+ See also:
17
+ ---------
18
+
19
+ `set args`, `show args`
15
20
  HELP
16
-
21
+
17
22
  CATEGORY = 'running'
18
23
  MAX_ARGS = 0 # Need at most this many
19
24
  SHORT_HELP = '(Hard) restart of program via exec()'
20
25
  end
21
-
26
+
22
27
  # This method runs the command
23
28
  def run(args)
24
29
 
@@ -1,14 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../command'
4
4
  class Trepan::Command::SaveCommand < Trepan::Command
5
5
 
6
6
  unless defined?(HELP)
7
7
  NAME = File.basename(__FILE__, '.rb')
8
8
  HELP = <<-HELP
9
- #{NAME} [--[no-]erase] [--output|-o FILENAME]
9
+ **#{NAME}** [{**--erase**|**--no-eraese**}] [**--output**|**-o** *filename*]
10
10
 
11
- Save settings to file FILENAME. If FILENAME not given one will be made
11
+ Save settings to file *filename*. If *filename* not given one will be made
12
12
  selected.
13
13
  HELP
14
14
 
@@ -18,16 +18,16 @@ selected.
18
18
 
19
19
  DEFAULT_OPTIONS = { :erase => true, }
20
20
  end
21
-
21
+
22
22
  def parse_options(options, args) # :nodoc
23
23
  parser = OptionParser.new do |opts|
24
- opts.on("-e", "--[no-]erase",
24
+ opts.on("-e", "--[no-]erase",
25
25
  "Add line to erase after reading") do
26
- |v|
26
+ |v|
27
27
  options[:erase] = v
28
28
  end
29
- opts.on("-o", "--output FILE", String,
30
- "Save file to FILE. ") do
29
+ opts.on("-o", "--output FILE", String,
30
+ "Save file to FILE. ") do
31
31
  |filename|
32
32
  options[:filename] = filename
33
33
  end
@@ -50,7 +50,7 @@ if __FILE__ == $0
50
50
  dbgr, cmd = MockDebugger::setup
51
51
  cmd.run([cmd.name])
52
52
  # require_relative '../../lib/trepanning'; debugger
53
- cmd.run([cmd.name, '--erase',
53
+ cmd.run([cmd.name, '--erase',
54
54
  '--output', File.join(Dir.tmpdir, 'save_file.txt')])
55
55
  # A good test would be to see we can read in those files without error.
56
56
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require 'optparse'
4
4
  require_relative '../command'
5
5
  require_relative '../../app/default'
@@ -15,37 +15,38 @@ class Trepan::Command::ServerCommand < Trepan::Command
15
15
  MAX_ARGS = 4 # Need at most this many
16
16
  NAME = File.basename(__FILE__, '.rb')
17
17
  HELP = <<-HELP
18
- #{NAME} [{--port|-p} NUM] [{--host|-h} HOST-OR-IP]
18
+ **#{NAME}** [{**--port**|**-p**} *num*] [{**--host**|**-h**} *host-or-IP*]
19
19
 
20
20
  Put session into server mode which allows an out-of-process or remote
21
- connection to the debugged program. --port and --host can be supplied
21
+ connection to the debugged program. `--port` and `--host` can be supplied
22
22
  to specify the port number to use and the host name for TCP
23
- connections. If neither is given, the default host (#{Trepan::DEFAULT_SETTINGS[:host]})
23
+ connections. If neither is given, the default host (#{Trepan::DEFAULT_SETTINGS[:host]})
24
24
  and the default port (#{Trepan::DEFAULT_SETTINGS[:port]}) are used.
25
25
 
26
26
  Examples:
27
- #{NAME} # Accept remote connections using defaults
28
- #{NAME} --port 123 # Accept remote connections on port 123
29
- #{NAME} --host my.host.net --port 2048
30
- #{NAME} -h my.host.net -p 2048 # same as above
27
+ ---------
28
+ #{NAME} # Accept remote connections using defaults
29
+ #{NAME} --port 123 # Accept remote connections on port 123
30
+ #{NAME} --host my.host.net --port 2048
31
+ #{NAME} -h my.host.net -p 2048 # same as above
31
32
  HELP
32
33
 
33
34
  SHORT_HELP = 'Go into out-of-process debugging (server) mode'
34
35
 
35
36
  end
36
-
37
+
37
38
  def parse_options(options, args) # nodoc
38
39
  parser = OptionParser.new do |opts|
39
- opts.on("-h", "--host NAME", String,
40
- "Host or IP used in TCP connections for --server or --client. " +
41
- "Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
42
- |name_or_ip|
40
+ opts.on("-h", "--host NAME", String,
41
+ "Host or IP used in TCP connections for --server or --client. " +
42
+ "Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
43
+ |name_or_ip|
43
44
  options[:host] = name_or_ip
44
45
  end
45
- opts.on("-p", "--port NUMBER", Integer,
46
- "Port number used in TCP connections for --server or --client. " +
47
- "Default is #{DEFAULT_SETTINGS[:port]}.") do
48
- |num|
46
+ opts.on("-p", "--port NUMBER", Integer,
47
+ "Port number used in TCP connections for --server or --client. " +
48
+ "Default is #{DEFAULT_SETTINGS[:port]}.") do
49
+ |num|
49
50
  options[:port] = num
50
51
  end
51
52
  end