You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 12, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+38-26Lines changed: 38 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1

2
2
3
-
Jard stands for Just Another Ruby Debugger, aims to provide a better experience while debugging Ruby. Ruby Jard supports the following major features at the moment:
3
+
Jard stands for Just Another Ruby Debugger, aims to provide a better experience while debugging Ruby. Ruby Jard supports the following major features at the moment:
4
4
5
5
- Informative Terminal UI, reduce your mental effort for repeated stuff so that you can focus on killing bugs.
6
-
- Highlighted source code screen.
7
-
- Backtrace visualization and navigation.
8
-
- Auto variable display in the current context.
6
+
- Highlighted source code screen.
7
+
- Backtrace visualization and navigation.
8
+
- Auto variable display in the current context.
9
9
- Multi-thread exploration and debugging.
10
10
11
11
Ruby Jard's core is [Byebug](https://github.com/deivid-rodriguez/byebug), an awesome de factor debugger for Ruby. Therefore, Ruby Jard supports most of Byebug's functionalities.
12
12
13
-
If you still don't know what it is, let's watch this video.
13
+
If you still don't know what it is, let's watch this video.
This panel shows the current line of code that your program is stopping, and surrounding related lines. The number of lines shown in this panel depends on your current terminal height, but never less than 5.
46
+
This panel shows the current line of code that your program is stopping, and surrounding related lines. The number of lines shown in this panel depends on your current terminal height, but never less than 5.
47
47
48
48
Ruby Jard supports any file extensions that your program runs into, especially `.rb`, `.erb`, `.haml` files. Other file types may encounter minor syntax highlighting issues.
49
49
50
50
Ruby Jard also supports inspecting gems and libraries, if you are interested.
This panel describes the current backtrace of the current thread your program is stopping. Each line of this panel describes the current Frame. What is frame and backtrace by the way? Let's step back a little bit at how Ruby executes your code. Internally, Ruby uses an interpreter to read and execute your code, line by line (technically, YARD instructions, but let's go with a simple version). When it meets a chunk of code that needs to open a new scope, like method calls or inline-block call, the interpreter creates a new structure to store the current context so that it can link to the next scope and go back later. This data structure is call Frame. The interpreter pushes frame into a stack, called backtrace (or stack trace, or call stack, whatever), and continues to execute your code. Each thread has a separate backtrace. To understand deeply, you may be interested in this wonderful slide: [Grow and Shrink - Dynamically Extending the Ruby VM Stack](https://www.slideshare.net/KeitaSugiyama1/grow-and-shrink-dynamically-extending-the-ruby-vm-stack).
56
+
This panel describes the current backtrace of the current thread your program is stopping. Each line of this panel describes the current Frame. What is frame and backtrace by the way? Let's step back a little bit at how Ruby executes your code. Internally, Ruby uses an interpreter to read and execute your code, line by line (technically, YARD instructions, but let's go with a simple version). When it meets a chunk of code that needs to open a new scope, like method calls or inline-block call, the interpreter creates a new structure to store the current context so that it can link to the next scope and go back later. This data structure is call Frame. The interpreter pushes frame into a stack, called backtrace (or stack trace, or call stack, whatever), and continues to execute your code. Each thread has a separate backtrace. To understand deeply, you may be interested in this wonderful slide: [Grow and Shrink - Dynamically Extending the Ruby VM Stack](https://www.slideshare.net/KeitaSugiyama1/grow-and-shrink-dynamically-extending-the-ruby-vm-stack).
57
57
58
58
Overall, the whole backtrace panel lets you know where you are stopping at, the trace of how your program is running. When combining with other tools and other panels, you will be surprised by how much information the bugger can help you when you encounter your bugs.
59
59
@@ -65,19 +65,19 @@ Each frame includes the following information:
The variable panel lets you explore all the local variables, instance variables, and constants in the current display context. Each variable is described by:
71
71
72
-
- Inline indicator: the beginning dot (`•`) implies a variable that appears in the current line.
72
+
- Inline indicator: the beginning dot (`•`) implies a variable that appears in the current line.
73
73
- Variable type: allow you to know the type of a variable at a single glance. Only built-in types, such as `int`, `flt`, `hash`, `bool`, `rng`, are supported. Instances of any classes will be noted as `var`.
74
74
- Size of variable: the size of collection-like variables. Current Jard version supports 3 types:
75
-
- Hash: this field shows the number of keys
75
+
- Hash: this field shows the number of keys
76
76
- Array: this field shows the number of items
77
77
- String: this field shows the number of character (fetched from`String#size` method)
78
78
- Variable inspection: the content of the variable. The current Jard version generates this field by calling `#inspect`. **Known issue**: this accidentally triggers materializing method of objects, such as `ActiveRecord::Relation`. Future Jard version gonna fix this by a new safe generator.
79
79
80
-
This panel interacts well with backtrace panel and backtrace-exploring commands such as (`up`, `down`, `frame`, etc.) to inspect relative variables at each frame layer in the program. A common use case is to recall the parameter values you forgot when digging too deep into a method call.
80
+
This panel interacts well with backtrace panel and backtrace-exploring commands such as (`up`, `down`, `frame`, etc.) to inspect relative variables at each frame layer in the program. A common use case is to recall the parameter values you forgot when digging too deep into a method call.
81
81
82
82
By default, the variables are sorted by the following criteria:
83
83
@@ -90,9 +90,9 @@ By default, the variables are sorted by the following criteria:
Show all the threads running at the moment. This panel is useful when you are working with a complicated multi-threaded environment like web server, or background jobs.
95
+
Show all the threads running at the moment. This panel is useful when you are working with a complicated multi-threaded environment like web server, or background jobs.
96
96
97
97
### Repl panel
98
98
@@ -102,12 +102,24 @@ An interactive Repl for you to interact with your program, inspect values, updat
102
102
103
103
## Commands
104
104
105
+
### List
106
+
107
+
**Repl command**: `list`
108
+
109
+
**Key binding:** F5
110
+
111
+
**Alias**: `l`
112
+
113
+
Refresh the whole terminal UI. This command doesn't move you to other steps, nor change any data in your session. It is useful (or the only way) to get back the beautiful UI if you type too much in the REPL console.
114
+
105
115
### Step
106
116
107
117
**Repl command**: `step`
108
118
109
119
**Key binding**: F7
110
120
121
+
**Alias**: `s`
122
+
111
123
Detect and step into a method call or block in the current line. If there isn't anything to step in, the program continues to next line. In case there are multiple methods on the same line, Jard hornors Ruby's execution order.
112
124
113
125
### Step out
@@ -116,6 +128,8 @@ Detect and step into a method call or block in the current line. If there isn't
116
128
117
129
**Key binding**: Shift + F7
118
130
131
+
**Alias**: `so`
132
+
119
133
The opposite of step out. This command is used to finish the execution of current frame, and jump to the next line of upper frame. In other words, this command is equivalent to the sequence `up` and `next`. If the neighbor frame already finishes, it continues with even higher frame.
120
134
121
135
This command is useful when you loose your interest in frame, and want to quickly go up again. One example is that you accidentally step into a longgggg loop with nothing useful. Another example is that you step into the library source code and don't really care what it does underlying.
@@ -126,14 +140,18 @@ This command is useful when you loose your interest in frame, and want to quickl
126
140
127
141
**Key binding**: F8
128
142
129
-
Continue to the next line in the current frame, by pass any steppable method call or blocks in the mid way unless they contains dynamic breakpoint or any `jard` attachment command. If the current frame already reaches the end, it continues to the next line of upper frame and so on.
143
+
**Alias**: `n`
144
+
145
+
Continue to the next line in the current frame, by pass any steppable method call or blocks in the mid way unless they contains dynamic breakpoint or any `jard` attachment command. If the current frame already reaches the end, it continues to the next line of upper frame and so on.
130
146
131
147
### Continue
132
148
133
149
**Repl command**: `continue`
134
150
135
151
**Key binding**: F9
136
152
153
+
**Alias**: `c`
154
+
137
155
Continue the execution of your program to the end, or stop at the first dynamic break point or `jard` attachment command. One common confusion is that long-running ruby processes, such as web server or background jobs, won't stop, and may be used to debug the next request without restarting. If you want to end everything and just exit the process, let's use `exit`.
138
156
139
157
### Up
@@ -142,7 +160,7 @@ Continue the execution of your program to the end, or stop at the first dynamic
142
160
143
161
**Key binding**: F6
144
162
145
-
Explore the upper frame. When you use this command, all associated displaying screens will be updated accordingly, but your program current position is still at the latest frame. This command is mostly used to explore, and view the trace, input parameters, or how your program stops at the current position. When use this command, you should have a glance at Variable panel, and Source panel to see the variables at destination frame.
163
+
Explore the upper frame. When you use this command, all associated displaying screens will be updated accordingly, but your program current position is still at the latest frame. This command is mostly used to explore, and view the trace, input parameters, or how your program stops at the current position. When use this command, you should have a glance at Variable panel, and Source panel to see the variables at destination frame.
146
164
147
165
You can combine with `next` or `step` to perform powerful execution redirection at the destination frame. Let's look at an example. You are debugging a chain of 10 rack middlewares, you go deep into the #9 middleware, found something, then want to go back to #5 middleware. It's pretty boring and frustrated to just use `next` or `step-out` and hope it eventually goes back. Now use `up` for some times (or `frame`, described below) to go to your desired frame, and use `next` there. Tada, it's magical, just like teleport.
148
166
@@ -164,13 +182,7 @@ Explore the lower frame. See `up` command for more information.
164
182
165
183
**Examples**:`frame 10`
166
184
167
-
Explore a particular frame with id `<frame_id>`. It's faster than `up` and `down`. See `up` command for more information.
168
-
169
-
170
-
171
-
## Roadmap
172
-
173
-
The ultimate goal of Ruby Jard is to provide a better experience while debugging Ruby. All the items in the roadmap are supposed to serve that. However, I have a life. There won't be any promises on when those items will be finished. In fact, this roadmap may be changed at anytime, depends on the current direction, focus and circumstances.
185
+
Explore a particular frame with id `<frame_id>`. It's faster than `up` and `down`. See `up` command for more information.
174
186
175
187
### [Done] Version 0.1.0: Proof of concept
176
188
@@ -182,7 +194,7 @@ The bootstrap version is just a series of ugly prints on stdout. It's frustrated
182
194
183
195
### Version 0.3.0: Complete the workflow
184
196
185
-
This version focuses on making Jard usable for daily activities of any developer. In other words, this version is to become a complete replacement for Byebug (sorry :pray:).
197
+
This version focuses on making Jard usable for daily activities of any developer. In other words, this version is to become a complete replacement for Byebug (sorry :pray:).
0 commit comments