[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240911174107.1217693-1-romank@linux.microsoft.com>
Date: Wed, 11 Sep 2024 10:41:07 -0700
From: Roman Kisel <romank@...ux.microsoft.com>
To: oleg@...hat.com
Cc: akpm@...ux-foundation.org,
apais@...rosoft.com,
benhill@...rosoft.com,
ebiederm@...ssion.com,
linux-kernel@...r.kernel.org,
romank@...ux.microsoft.com,
ssengar@...rosoft.com,
sunilmut@...rosoft.com,
torvalds@...ux-foundation.org,
vdso@...bites.dev,
workingjubilee@...il.com
Subject: Re: [PATCH 1/1] ptrace: Get tracer PID without reliance on the proc FS
On 09/11, Oleg Nesterov wrote:
> On 09/10, Roman Kisel wrote:
> >
> > On 09/09, Oleg wrote:
> >
>
> > > Yet another thing in this discussion I can't understand... sorry, I tried.
> > > You do not need to teach, say, gdb to recognize this pattern. You can just do
> > >
> > > $ gdb -ex 'b please_insert_the_breakpoint_here' ...
> > >
> > > Nevermind, as I have already said you can safely ignore me. I still do not
> > > see any "real" use-case for breakpoint_if_debugging(), but I guess that is
> > > due to my ignorance and lack of imagination.
> >
> > I've started this so let me butt in and take up the gaunlet.
> >
> > Lambda's would be the most prominent example to me[1]. The toolchain
> > doesn't give them the user-accesible type and the name as it does for
> > the functions.
>
> And?
>
You wanted an example of '"real" use-case for breakpoint_if_debugging()':
> > > Nevermind, as I have already said you can safely ignore me. I still do not
> > > see any "real" use-case for breakpoint_if_debugging(), but I guess that is
> > > due to my ignorance and lack of imagination.
I have provided them, and illustrated how it is tiresome to set the breakpoint
in the debugger in these cases so can add a call to breakpoint_if_debugging()
to these places instead.
> Once again, what I tried to suggest is a single "nop" function,
> "void please_insert_the_breakpoint_here()" which simply does asm("ret") and
>
> #define breakpoint_if_debugging() \
> please_insert_the_breakpoint_here()
>
> Or, to make it more cheap,
>
> #define breakpoint_if_debugging() \
> asm volatile ("call please_insert_the_breakpoint_here" : ASM_CALL_CONSTRAINT);
>
> so that compiler will know that breakpoint_if_debugging() doesn't change the regs.
>
> Again, again, I am not saying that this is necessarily the best solution.
> Just I fail to understand your email, sorry.
No worries, appreciate your willingness to help!
>
> Oleg.
Roman
Powered by blists - more mailing lists