Re: [PATCH v3] gdb/testsuite: add test for memory requirements of gcore

Guinevere Larsen
2025-03-05T20:04:12Z

On 3/4/25 3:19 PM, Tom Tromey wrote:
>>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
> Guinevere> The test runs twice, once with the inferior allocating 4Mb of memory,
> Guinevere> and the other allocating 64Mb. My plan was to find the rate at which
> Guinevere> things increase based on inferior size, and have that tested to ensure
> Guinevere> we're not growing that requirement accidentally, but my testing
> Guinevere> actually showed memory requirements going down as the inferior increases,
> Guinevere> so instead I just hardcoded that we need less than 2Mb for the command,
> Guinevere> and it can be tweaked later if necessary.
>
> This seems fine to me. I didn't understand why it needed to attach, it
> seems like just running it would be the same? But also it doesn't
> really matter, considering you've done the work.
>
> Approved-By: Tom Tromey <tom@tromey.com>
>
> thanks,
> Tom
>
I noticed today as I returned from a holiday that I misunderstood the
issue on v2, so I made this small change to the test, to stop it from
falling. I'll push the test on friday if there are no comments since I
think it is a pretty trivial change.

---

diff --git a/gdb/testsuite/gdb.base/gcore-memory-usage.exp
b/gdb/testsuite/gdb.base/gcore-memory-usage.exp
index 1e31578d4a9..db7f270a5e8 100644
--- a/gdb/testsuite/gdb.base/gcore-memory-usage.exp
+++ b/gdb/testsuite/gdb.base/gcore-memory-usage.exp
@@ -59,7 +59,7 @@ proc run_test {megs} {

gdb_test "attach $inferior_pid" "Attaching to.*"
set line [gdb_get_line_number "TAG: BREAK HERE" $::testfile.c]
-       gdb_breakpoint "$line" "break at to known line"
+       gdb_breakpoint "${::srcfile}:$line" "break at to known line"
gdb_continue_to_breakpoint "continue to known line"

# Get the important info.

--
Cheers,
Guinevere Larsen
She/Her/Hers