[Lldb-commits] [PATCH] D107660: [lldb] Upstream support for Foundation constant classes

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 6 12:14:53 PDT 2021

jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Just a few little nits.

Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:509
+    float flt_value = 0.0f;
+    memcpy(&flt_value, &flt_as_int, sizeof(flt_as_int));
+    NSNumber_FormatFloat(valobj, stream, flt_value, options.GetLanguage());
Shouldn't this be done with a DataExtractor?  The code is assuming that you can get a valid host float by pasting target bytes into a host float.  While most likely everybody is using the same float & double representations these days, that doesn't seem like something we should rely on.

Comment at: lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:908-913
+  m_keys_ptr = process_sp->ReadUnsignedIntegerFromMemory(
+      valobj_addr + 3 * m_ptr_size, m_ptr_size, 0, error);
+  if (error.Fail())
+    return false;
+  m_objects_ptr = process_sp->ReadUnsignedIntegerFromMemory(
+      valobj_addr + 4 * m_ptr_size, m_ptr_size, 0, error);
These are pointers, shouldn't we be using ReadPointerFromMemory?



More information about the lldb-commits mailing list