File tree 1 file changed +7
-13
lines changed
1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -34,26 +34,20 @@ and [GDB's Python API](https://sourceware.org/gdb/current/onlinedocs/gdb/Python-
34
34
- Modify [ ` examples/examples.c ` ] ( examples/examples.c ) to try your own code.
35
35
36
36
Tested in Ubuntu 20.04 and Windows 10 under WSL.
37
- macOS is not supported (to make it work one would need to workaround the
38
- linker's lack of ` --wrap ` , and the fact that Apple makes it
37
+ macOS is not supported (it could be adapted, but Apple makes it
39
38
[ particularly painful] ( https://dev.to/jasonelwood/setup-gdb-on-macos-in-2020-489k ) to use
40
- GDB in macOS).
39
+ GDB in macOS anyway ).
41
40
42
41
43
42
### To use it in your own project
44
43
45
- - Link your code with ` visualize-c-memory/malloc-wrapper.c ` .
46
- - Pass ` -Wl,--wrap=malloc -Wl,--wrap=free ` to gcc when linking, which allows to watch the
47
- heap by wrapping ` malloc/free ` calls. You can also optionally wrap any of the following
48
- functions:
49
- ```
50
- calloc realloc strdup strndup
51
- ```
52
- by passing ` -Wl,--wrap=<function> ` (once for each function).
53
-
54
- - Load ` visualize-c-memory/visualize-c-memory.py ` in GDB when it launches, by adding
44
+ - Build ` visualize-c-memory.so ` (by running ` make ` in ` src ` ).
45
+ - Load the ` .so ` and the python module in GDB by adding
55
46
the following to your ` launch.json ` :
56
47
```
48
+ "environment": [
49
+ {"name":"LD_PRELOAD", "value":"${workspaceFolder}/<path-to>/visualize-c-memory.so"},
50
+ ],
57
51
"setupCommands": [
58
52
{
59
53
"text": "source ${workspaceFolder}/<path-to>/visualize-c-memory.py"
You can’t perform that action at this time.
0 commit comments