[Lldb-commits] [PATCH] Refactor POSIXThread::GetRegisterContext and use i386 register context

Todd Fiala tfiala at google.com
Thu Feb 13 17:02:29 PST 2014


  Digging a little deeper:

  I see my comments above on the macros not being used in the cpp is erroneous.  We do a clever thing where we define the macros in the .cpp, and then reference them from a .h file later on.  Not fond of that, but that's a different story.

  So - I added an assert in RegisterContextLinux_i386.cpp's context constructor that verifies that our repeated version of the system header's "struct user" is the same size as our duplicated version, and bails out if not.  Sure enough, our UserArea struct is not the right size, and therefore the DRx register offset calculation is wrong.

  Our UserArea is much larger for some reason vs. the system header.

  I'd suggest that we have a larger problem here, which is that we're repeating a system header.  This is very anti-DRY, and is the cause of the bug in this case.  Eyeballing it, it's not entirely evident what is different, but I'll be looking at the FXSAVE bit next.

  sizeof(UserArea) [688] != sizeof(struct user) [284]
  lldb: /home/tfiala/lldb/work/llvm/tools/lldb/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp:76: RegisterContextLinux_i386::RegisterContextLinux_i386(const lldb_private::ArchSpec&): Assertion `false && "DRY has bitten us, our UserArea is not matching the system"' failed.

http://llvm-reviews.chandlerc.com/D2765



More information about the lldb-commits mailing list