Re: [PATCH 1/1] ptrace: Get tracer PID without reliance on the proc FS

From: Oleg Nesterov
Date: Mon Sep 09 2024 - 15:38:00 EST


On 09/07, Jubilee Young wrote:
>
> > Perhaps it makes sense to discuss the alternatives? Say, a process can have a
> > please_insert_the_breakpoint_here() function implemented in asm which just does
> > asm(ret).
>
> There's some merit in having the debuggers recognize this pattern, as that
> then would save every language that wants to have this power available
> the trouble of reimplementing it. But first debuggers must recognize it,
> which would require teaching each of them, which can be... tedious.

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.

Oleg.