[PATCH] Add register dumping support to SuspendedThreadsList.

Alexander Potapenko glider at google.com
Fri Mar 29 01:02:54 PDT 2013



================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld_linux.cc:329
@@ +328,3 @@
+// Platform-specific methods from SuspendedThreadsList.
+int SuspendedThreadsList::GetRegistersAndSP(uptr index,
+                                            uptr *buffer,
----------------
SP is already contained in the user_regs_struct, do you really need to pass it separately?

================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld.h:35
@@ +34,3 @@
+  // The buffer in GetRegistersAndSP should be at least this big.
+  static uptr RegisterCount();
+  uptr thread_count() const { return thread_ids_.size(); }
----------------
This is a const function as well.

BTW are you going to provide any classes/methods that encapsulate the register extraction from user_regs_struct (you obviously won't need EFLAGS and segment registers for leak checking)? If so, it's better to move the RegisterCount() logic there.
Anyway, I don't see much sense in calculating the size of the buffer as sizeof(uptr) * (sizeof(user_regs_struct) / sizeof(uptr))


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



More information about the llvm-commits mailing list