[llvm-dev] How to read stack map

Kavindu Gimhan Zoysa via llvm-dev llvm-dev at lists.llvm.org
Wed May 12 21:19:09 PDT 2021


Hi Philip,

Let's say my code structure is as follows.


>
>
>
>
>
>
>
> *func foo() {}func bar() {      call foo(); // this is a statepoint}func
> readLLVMStackMap() {}func main() {      call bar(); // this is a
> statepoint      call readLLVMStackMap();}*


Actually, my question is that how do I read the LLVM Stack map. Simply I
want to implement *readLLVMStackMap *method, in order to read the LLVM
Stack Map. What is the best approach should I follow?

Philip, that was my question. So according to your previous answers, What I
need to do is following this document
https://llvm.org/docs/StackMaps.html#stack-map-section. Am I right?

Kavindu Gimhan Zoysa,
BSc(Hons) | ENTC | UoM,
SSE | WSO2

GitHub <https://github.com/KavinduZoysa> LinkedIn
<https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium
<https://medium.com/@kavindugimhanzoysa>


On Thu, 13 May 2021 at 00:14, Philip Reames <listmail at philipreames.com>
wrote:

> This is generally the right approach, yes.
>
> You may also find include/llvm/Object/StackMapParser.h helpful.
>
> Philip
> On 5/12/21 2:52 AM, Kavindu Gimhan Zoysa wrote:
>
> This is what I followed.
> https://stackoverflow.com/questions/8045108/use-label-in-assembly-from-c
>
> Kavindu Gimhan Zoysa,
> BSc(Hons) | ENTC | UoM,
> SSE | WSO2
>
> GitHub <https://github.com/KavinduZoysa> LinkedIn
> <https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium
> <https://medium.com/@kavindugimhanzoysa>
>
>
> On Wed, 12 May 2021 at 12:45, Kavindu Gimhan Zoysa <kavindu175 at gmail.com>
> wrote:
>
>> Hi all,
>>
>> I was able to generate the Stack Map which is shown here
>> https://llvm.org/docs/StackMaps.html#stack-map-format. Now I want to
>> read those entries. What I did was, I manually change the .s file as shown
>> below (Added the *.globl __LLVM_StackMaps *manually). Then I can read
>> the entries using C code.
>>
>> .globl __LLVM_StackMaps
>> __LLVM_StackMaps:
>> .byte 3
>> .byte 0
>> .short 0
>>
>> I want to know, whether this is the correct approach. If not could you
>> please suggest me the correct approach?
>>
>> Really appreciate your input on this.
>>
>> Thank you,
>> Kavindu
>>
>> Kavindu Gimhan Zoysa,
>> BSc(Hons) | ENTC | UoM,
>> SSE | WSO2
>>
>> GitHub <https://github.com/KavinduZoysa> LinkedIn
>> <https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium
>> <https://medium.com/@kavindugimhanzoysa>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210513/ead4ffe1/attachment.html>


More information about the llvm-dev mailing list