C++ Logo

std-proposals

Advanced search

Re: [std-proposals] #include <debug>

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 27 Nov 2024 17:25:11 -0800
On Wednesday 27 November 2024 14:11:34 Pacific Standard Time Frederick
Virchanza Gotham via Std-Proposals wrote:
> * is_immediate_jump : Checks the machine code pointed to by a function
> pointer to see if the first instruction is a jump, and if so, returns
> the address of the jump destination.

Can return a false negative, in case the implementation does not yet
understand a new instruction, such as the new absolute JMP instruction coming
with APX. That's a rare occurrence (probably only once every couple of
decades), but possible nonetheless.

> * size_of_function : Returns the size in bytes of the machine code of
> a function (not sure if the object file containing the function's
> machine code always has the function's total size in bytes)

Useless for functions that aren't contiguous. Unimplementable for anything
else.

> * is_executable_memory : Returns true if code can be executed at the
> specified address
>
> * is_readonly_memory : Return true if the specified span<byte> points
> to memory which is either partially or fully readonly.

Implementable, but very expensive on Linux (must read /proc/self/maps). I
don't think it's implementable in other Unix OSes.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-11-28 01:25:16