Hi Greg,

Thanks a lot for your reply, please find below my answers.

> You can install new python commands that can do the job to work out the
> details.
> http://lldb.llvm.org/python-reference.html
> You can basically install a new "intel" command and parse all of the options
> "show mpx-bounds ..." or "set mpx-bounds ..." from within this new command.
> You can use the public LLDB API to look through the process and do things. Let
> me know if you need any help with this. There is also a API to add custom
> commands from C++ plug-ins. Enrico Granata did this work and can answer
> more questions on that. Either way, both commands (python and C++ plug-ins)
> have access to the public API for LLDB, so the code you will write will use 
> the
> same API. So I would stick with python for now to get things working.

I think I would rather start right away with the C++ approach. If I understand 
correctly, it means to create a specific Intel plugin under the directory 
source/Plugins and use the LLDB API to add the custom command. 

> Some questions for you:
> - How do plan on detecting that you have an intel processor?

I thought of checking if the target architecture is either llvm::Triple::x86 or 
llvm::Triple::x86_64. Do you think there is a better approach to this?

> - Do you need access to any process registers? If so, are these registers 
> thread
> specific? Are these registers available currently on linux and MacOS?

I only need to access the MPX configuration register, BNDCFGU. As far as I 
know, MacOS doesn't have MPX support, so I also didn't implement the MPX 
support for MacOS in LLDB, which means it is only available in Linux at the 

> - How do you locate the BT? (or do you even need to?). Is there symbol? Can
> you extract all values in the bounds table once you locate it?

The bound tables are allocated contiguously in the process memory, starting 
from the Bound Directory address which is stored in the BNDCFGU register. 
Therefore, in the plugin I only need to access this register, do the 
appropriate calculations and then access the process memory to get the 
requested bound table entry.

- Val 

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

lldb-dev mailing list

Reply via email to