[llvm-dev] Print void* pointer using !DI* information in human readable format

via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 30 08:16:48 PST 2019


> -----Original Message-----
> From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Peng
> Yu via llvm-dev
> Sent: Wednesday, January 30, 2019 10:42 AM
> To: llvm-dev
> Subject: [llvm-dev] Print void* pointer using !DI* information in human
> readable format
> 
> Hi,
> 
> Given that the !DI* metadata is available in .ll file, I am wondering
> if there is a way to case any void* pointer appropriately according to
> the debug information and print the data pointed by the void* pointer
> in a human-readable format in C.
> 
> I think that lldb should have some facility to do this.

You should be able to cast the void* pointer to another pointer type
and then dereference it. I personally am not familiar with lldb syntax
but in gdb it would be something like "p *(other*)pointer"

> But I am wondering what is the best way to do it in C. Does anybody
> know? Is there a library to facilitate this? Thanks.

Assuming you are writing a debugger or other tool to examine the state
of a running program, LLVM's DebugInfo library might be helpful.
--paulr


> 
> --
> Regards,
> Peng
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list