Is there a way to get good output for the flag register using lldb?

Here is the result I get when I read the rflags register using lldb

(lldb) register read rflags
  rflags = 0x0000000000000246

I know that each bit represents a specific flag, but it would be nice to have an output that gave me the meaning of these flags (e.g. carry flag, zero flag, etc.)

Is there a way to do this with lldb?

+4
source share
2 answers

There is no automatic way to do this.

You cannot use data formatters because they are type-related and there is no “type of flag case”. And the formats you can pass on the command line to register readformat all the value.

"" , , .

lldb, , , . :

http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/cmdtemplate.py

, :

frame = exe_ctx.GetFrame()

:

rflags_value = frame.FindRegister("rflags")

error = lldb.SBError()
uint_value = rflags_value.GetValueAsUnsigned(error)

SBData :

data_value = rflags_value.GetData()

SBData uint8. , :

first_byte = data_value.uint8[0]

... , , , , , . __init , lldb. :

command script import <path_to_py>/my_command.py

lldb.

API lldb:

http://lldb.llvm.org/python_reference/index.html

"script python" REPL lldb ( script), API .

+2

, , script.

, lldb python script.

/eflags/rflags, .

,

0

Source: https://habr.com/ru/post/1690349/


All Articles