Re: [PATCH] infcall: Add support for integer literals as reference function paramters

Keith Seitz
2025-10-20T19:00:53Z

Hi, Tom,

On 10/17/25 7:49 AM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>
> Keith> This patch attempts to mitigate the shortcomings of passing literals
> Keith> to inferior function calls requiring references. The specific use case here
> Keith> is std::map's operator[]:
>
> Keith> (gdb) print int_map[1]
> Keith> Attempt to take address of value not located in memory.
>
> I didn't see in the text or the patch what the method type really is.

I believe I have addressed this in upcoming v2.

> Keith> +#include
> Keith> +#include <string>
>
> It's better for tests not to use libstdc++ stuff if possible, and to
> just write out a method with the problem signature in a locally-defined
> type.

Gotcha. I have removed all the offending libstdc++ classes and rewritten
using just basic function/method calls.

> Keith> -if {[build_executable $testfile.exp $testfile $srcfile {debug c++}] == -1} {
> Keith> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
>
> This results in starting an extra gdb that is immediately exited.

Reverted.
Thank you for the review.

Keith