[Lldb-commits] [lldb] r275060 - Change the /proc/<pid>/maps to not assert on incorrect input
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 11 06:43:28 PDT 2016
Author: tberghammer
Date: Mon Jul 11 08:43:27 2016
New Revision: 275060
URL: http://llvm.org/viewvc/llvm-project?rev=275060&view=rev
Log:
Change the /proc/<pid>/maps to not assert on incorrect input
If LLDB reads some incorrect input form /proc/<pid>/maps then it
should report an error instead of assert-ing as we don't want to
crash in case of an incorrect maps file.
Differential revision: http://reviews.llvm.org/D22211
Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=275060&r1=275059&r2=275060&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon Jul 11 08:43:27 2016
@@ -1919,31 +1919,28 @@ ParseMemoryRegionInfoFromProcMapsLine (c
const char read_perm_char = line_extractor.GetChar ();
if (read_perm_char == 'r')
memory_region_info.SetReadable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (read_perm_char == '-') && "unexpected /proc/{pid}/maps read permission char" );
+ else if (read_perm_char == '-')
memory_region_info.SetReadable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps read permission char");
// Handle write permission.
const char write_perm_char = line_extractor.GetChar ();
if (write_perm_char == 'w')
memory_region_info.SetWritable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (write_perm_char == '-') && "unexpected /proc/{pid}/maps write permission char" );
+ else if (write_perm_char == '-')
memory_region_info.SetWritable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps write permission char");
// Handle execute permission.
const char exec_perm_char = line_extractor.GetChar ();
if (exec_perm_char == 'x')
memory_region_info.SetExecutable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (exec_perm_char == '-') && "unexpected /proc/{pid}/maps exec permission char" );
+ else if (exec_perm_char == '-')
memory_region_info.SetExecutable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps exec permission char");
return Error ();
}
More information about the lldb-commits
mailing list