Skip to content

Commit a9b55f7

Browse files
committedFeb 22, 2021
README
1 parent 91aa350 commit a9b55f7

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed
 

‎README.md

+7-13
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,20 @@ and [GDB's Python API](https://sourceware.org/gdb/current/onlinedocs/gdb/Python-
3434
- Modify [`examples/examples.c`](examples/examples.c) to try your own code.
3535

3636
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
3938
[particularly painful](https://dev.to/jasonelwood/setup-gdb-on-macos-in-2020-489k) to use
40-
GDB in macOS).
39+
GDB in macOS anyway).
4140

4241

4342
### To use it in your own project
4443

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
5546
the following to your `launch.json`:
5647
```
48+
"environment": [
49+
{"name":"LD_PRELOAD", "value":"${workspaceFolder}/<path-to>/visualize-c-memory.so"},
50+
],
5751
"setupCommands": [
5852
{
5953
"text": "source ${workspaceFolder}/<path-to>/visualize-c-memory.py"

0 commit comments

Comments
 (0)
Please sign in to comment.