[Bug gdb/34288] gdb accepts invalid DW_OP_bra / DW_OP_skip branch targets

firmiana402 at gmail dot com via Gdb-prs <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34288

--- Comment #2 from Jielun Wu <firmiana402 at gmail dot com> ---
(In reply to Tom Tromey from comment #1)
> (In reply to Jielun Wu from comment #0)
> 
> > - the decoded target lands in the middle of another opcode's operand bytes
> 
> AFAIK nothing in the DWARF standard prohibits this, so I think gdb
> has to accept it.
> 
> If you know otherwise, that would be interesting to learn.
> 
> > This may also be related to bug #34239. I would be interested in others'
> > opinions on whether these cases should be treated as invalid DWARF
> > expressions and rejected by GDB.
> 
> Fixing this & the other things you found would be completely fine.
> Historically gdb is pretty lax about things like this,
> since malformed DWARF is unusual in practice.
> 
> Here's some info on how to send patches:
> https://sourceware.org/gdb/wiki/ContributionChecklist

Thank you for the clarification.

I agree that the DWARF standard does not explicitly require a DW_OP_bra or
DW_OP_skip destination to coincide with the first byte of an operation.

My initial perspective was grounded in the model of an expression as a sequence
of discrete operations (opcode followed by operand bytes), which made branching
into the middle of an operand feel conceptually inconsistent. However, your
interpretation is equally reasonable, and given the absence of an explicit
requirement in the standard, it makes perfect sense for GDB to continue
accepting such targets.

Thank you as well for the pointer to the contribution guidelines. Since I am
new to the GNU/GDB community, I will start learning the patch submission
process and may submit some patches in the near future.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.