[Lldb-commits] [PATCH] D111131: [LLDB] Round XML register bitsize to byte boundary

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 5 04:06:57 PDT 2021


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4260-4261
             if (llvm::to_integer(value, reg_info.byte_size))
-              reg_info.byte_size /= CHAR_BIT;
+              reg_info.byte_size =
+                  (reg_info.byte_size + CHAR_BIT - 1) / CHAR_BIT;
           } else if (name == "type") {
----------------
`llvm::divideCeil(reg_info.byte_size, CHAR_BIT)`, perhaps


================
Comment at: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4357
 
         assert(reg_info.byte_size != 0);
         registers.push_back(reg_info);
----------------
mgorny wrote:
> omjavaid wrote:
> > mgorny wrote:
> > > omjavaid wrote:
> > > > @mgorny the assert already exists but then we also want to allow bit sized registers although they ll be viewed as byte length for now.
> > > Ah, right. I suppose you could skip zero-byte registers though. That should amend the assert with better release behavior.
> > on a second thought, I dont see a zero sized register being sent by stub as a big enough reason to abort the whole debug session unless its one of GPRs. May be we skip the assert altogether and replace it with an error message. 
> > What do you think?
> Yes, you are correct. Probably `LLDB_LOG` would go in line with how we handle these things.
Yeah, I don't think crashing is a good response to the stub sending us nonsensical register definitions. Though that seems like a separate issue..


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111131/new/

https://reviews.llvm.org/D111131



More information about the lldb-commits mailing list