[Lldb-commits] [lldb] r192486 - Use existing llvm::RoundUpToAlignment in ELF note parsing

Ed Maste emaste at freebsd.org
Fri Oct 11 12:39:43 PDT 2013


Author: emaste
Date: Fri Oct 11 14:39:42 2013
New Revision: 192486

URL: http://llvm.org/viewvc/llvm-project?rev=192486&view=rev
Log:
Use existing llvm::RoundUpToAlignment in ELF note parsing


Modified:
    lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=192486&r1=192485&r2=192486&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Fri Oct 11 14:39:42 2013
@@ -363,13 +363,6 @@ enum {
     NT_FREEBSD_PROCSTAT_AUXV = 16
 };
 
-/// Align the given value to next boundary specified by the alignment bytes
-static uint32_t
-AlignToNext(uint32_t value, int alignment_bytes)
-{
-    return (value + alignment_bytes - 1) & ~(alignment_bytes - 1);
-}
-
 /// Note Structure found in ELF core dumps.
 /// This is PT_NOTE type program/segments in the core file.
 struct ELFNote
@@ -421,7 +414,7 @@ struct ELFNote
             }
         }
 
-        const char *cstr = data.GetCStr(offset, AlignToNext(n_namesz, 4));
+        const char *cstr = data.GetCStr(offset, llvm::RoundUpToAlignment(n_namesz, 4));
         if (cstr == NULL)
         {
             Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
@@ -526,7 +519,7 @@ ProcessElfCore::ParseThreadContextsFromN
 
         size_t note_start, note_size;
         note_start = offset;
-        note_size = AlignToNext(note.n_descsz, 4);
+        note_size = llvm::RoundUpToAlignment(note.n_descsz, 4);
 
         // Store the NOTE information in the current thread
         DataExtractor note_data (segment_data, note_start, note_size);





More information about the lldb-commits mailing list