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
Copy file name to clipboardExpand all lines: README.md
+41-1Lines changed: 41 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Remove all query parameters by passing in an empty string.
50
50
```
51
51
import querymodifier;
52
52
set req.url = querymodifier.modifyparams(url=req.url, params="", exclude_params=true);
53
-
# Or use the conveniecen function, `excludeallparams`.
53
+
# Or use the convenience function, `excludeallparams`.
54
54
# set req.url = querymodifier.excludeallparams(url=req.url);
55
55
56
56
# Original URL: example.com/?search=name&ts=123456789&v=123456789&id=987654321
@@ -80,6 +80,8 @@ I'm happy to review any PRs. Any bug reports are also welcome.
80
80
81
81
### Debugging
82
82
83
+
#### ASan
84
+
83
85
The module can also be built with [`AddressSanitizer`](https://github.com/google/sanitizers/wiki/AddressSanitizer) support.
84
86
85
87
It is recommended that when developing on the module, you build with `AddressSanitizer` support enabled in order to help identify any memory issues with the VMOD.
@@ -94,9 +96,47 @@ There are also some scripts in the `debug` directory to assist. Navigate to the
94
96
95
97
_Note_: Do not use the module built with ASan support in production. This is meant for development purposes only.
96
98
99
+
#### gdb
100
+
101
+
`gdb` is also included in the debug Dockerfile for your convenience.
102
+
103
+
- After you've brought up Docker Compose, exec into the Varnish container.
104
+
105
+
```bash
106
+
docker compose exec varnish
107
+
```
108
+
109
+
- Attach `gdb` to the Varnish child process. You can either get the PID with `ps` or Varnish will print the child PID to the console like `varnish-1 | Debug: Child (31) Started`.
110
+
111
+
```bash
112
+
(gdb) attach 31
113
+
```
114
+
115
+
- Set a breakpoint, for example on the `vmod_modifyparams` function. A `.gdbinit` file is included in the Docker container to instruct `gdb` where to find the VMOD shared libraries.
116
+
117
+
```bash
118
+
(gdb) b vmod_modifyparams
119
+
Breakpoint 1 at 0xffff7e0b14cc: file vmod_querymodifier.c, line 219.
120
+
```
121
+
122
+
- Send a request to `http://localhost:8080` that exercises the VMOD.
123
+
124
+
- Continue the debugger and then use `gdb` as you normally would.
0 commit comments