[Lldb-commits] [lldb] r164183 - /lldb/trunk/source/Core/ArchSpec.cpp
Jason Molenda
jmolenda at apple.com
Tue Sep 18 16:27:18 PDT 2012
Author: jmolenda
Date: Tue Sep 18 18:27:18 2012
New Revision: 164183
URL: http://llvm.org/viewvc/llvm-project?rev=164183&view=rev
Log:
Allow for numeric cputype-cpusubtype specifications where the subtype is 0. Use errno to
detect strtoul parse failure instead of return value of 0. <rdar://problem/12198994>
Modified:
lldb/trunk/source/Core/ArchSpec.cpp
Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=164183&r1=164182&r2=164183&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Tue Sep 18 18:27:18 2012
@@ -10,6 +10,7 @@
#include "lldb/Core/ArchSpec.h"
#include <stdio.h>
+#include <errno.h>
#include <string>
@@ -492,11 +493,13 @@
{
// Accept "12-10" or "12.10" as cpu type/subtype
char *end = NULL;
+ errno = 0;
uint32_t cpu = ::strtoul (triple_cstr, &end, 0);
- if (cpu != 0 && end && ((*end == '-') || (*end == '.')))
+ if (errno == 0 && cpu != 0 && end && ((*end == '-') || (*end == '.')))
{
+ errno = 0;
uint32_t sub = ::strtoul (end + 1, &end, 0);
- if (sub != 0 && end && ((*end == '-') || (*end == '.') || (*end == '\0')))
+ if (errno == 0 && end && ((*end == '-') || (*end == '.') || (*end == '\0')))
{
if (SetArchitecture (eArchTypeMachO, cpu, sub))
{
More information about the lldb-commits
mailing list