[llvm] [DWARFVerifier] Verify that DW_AT_LLVM_stmt_sequence is set correctly (PR #152807)

Peter Rong via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 09:54:29 PDT 2025


DataCorrupted wrote:

I agree it's the emission of dwarf not the parsing.

In terms of whether we should fix it now or later: I think I have found the
cause of the problem, if it is really the root cause, I can attempt a pr.

Yuyang (Peter) Rong
Research Scientise @ Meta

On Wed, Sep 3, 2025, 9:39 AM David Blaikie ***@***.***> wrote:

> ***@***.**** commented on this pull request.
> ------------------------------
>
> In llvm/test/tools/llvm-dwarfdump/verify_stmt_seq.yaml
> <https://github.com/llvm/llvm-project/pull/152807#discussion_r2319524366>:
>
> > +# 0xd3 would be a valid offset, if the line table wan't ill formed with two rows having the same PC (0x8c).
> +# CHECK_INVALID: error: DW_AT_LLVM_stmt_sequence offset 0x000000d3 does not point to a valid sequence offset in the line table
> +# CHECK_INVALID: DW_AT_LLVM_stmt_sequence [DW_FORM_sec_offset]     (0x000000d3)
> +
> +# CHECK_DEBUG_LINE:      0x000000d3: 05 DW_LNS_set_column (85)
> +# CHECK_DEBUG_LINE-NEXT: 0x000000d5: 0a DW_LNS_set_prologue_end
> +# CHECK_DEBUG_LINE-NEXT: 0x000000d6: 00 DW_LNE_set_address (0x000000000000008c)
> +# CHECK_DEBUG_LINE-NEXT: 0x000000e1: 03 DW_LNS_advance_line (30)
> +# CHECK_DEBUG_LINE-NEXT: 0x000000e3: 01 DW_LNS_copy
> +# CHECK_DEBUG_LINE-NEXT:             0x000000000000008c     30     85      1   0             0       0  is_stmt prologue_end
> +# CHECK_DEBUG_LINE-NEXT: 0x000000e4: 00 DW_LNE_end_sequence
> +# CHECK_DEBUG_LINE-NEXT:             0x000000000000008c     30     85      1   0             0       0  is_stmt end_sequence
>
> The problem is consecutive one-length sequences can't be manually
> terminated correct.
>
> I still don't understand this - I think it's a bug in the emission/DWARF,
> not in the parsing of it.
>
> let's avoid emitting DW_AT_LLVM_stmt_sequence for these zero/one-length
> functions by making the thunk two-instruction long, and only emit
> DW_AT_LLVM_stmt_sequence for 2+ length functions.
>
> Yeah, this seems to me like something's being missed. DWARF, so far as I
> know, certainly can describe a one-byte-long sequence - if we are failing
> to emit DWARF that does that I think that's a bug in the emission, not a
> limitation of DWARF - we shouldn't be working around it by making the code
> longer to avoid one-byte-long cases, we should be fixing our handling of
> one-byte-long cases to emit DWARF that correctly describes a one-byte-long
> sequence.
>
>> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/152807#discussion_r2319524366>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AFQQFGC2P3AEARGGS3E3GSL3Q4KTLAVCNFSM6AAAAACDPAGAZKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTCOBRGQ2TCNRRHE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>


https://github.com/llvm/llvm-project/pull/152807


More information about the llvm-commits mailing list