[PATCH] gdb/testsuite: test for memory leaks in gdb.Inferior.read_memory()
Tom Tromey
tom@tromey.com
Wed Sep 25 16:57:13 GMT 2024
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> However, we already have gdb.python/py-inferior-leak.exp in upstream
Andrew> GDB, which makes use of the Python tracemalloc module to check for
Andrew> memory leaks in a corner of the Python API, so I figured it wouldn't
Andrew> hurt to rewrite the test in the same style.
Andrew> And so here is a test for a bug which was closed 12 years ago.
:)
Andrew> The Python script in the new test is mostly a copy&paste from
Andrew> py-inferior-leak.py with the core changed to do a memory read instead
Andrew> of inferior creation. I did consider rewriting both tests into a
Andrew> single file, maybe, py-memory-leak.py, which would make it easier to
Andrew> add additional similar tests in the future. For now I've held off
Andrew> doing that, but if this gets merged then I _might_ revisit this idea.
Andrew> If folk feel that this new test should only be accepted if I do this
Andrew> rewrite then let me know and I can get that done.
I think it's fine as-is.
Having this be generalized to make it simpler to add new leak tests
might be nice but I don't think it's a requirement.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
More information about the Gdb-patches
mailing list