Skip to content

Commit

Permalink
Release 0.3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbukowski committed Oct 9, 2017
1 parent ead9a43 commit 1ddd7d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DBDebugToolkit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'DBDebugToolkit'
s.version = '0.2.1'
s.version = '0.3.0'
s.summary = 'Set of easy to use debugging tools for iOS developers & QA engineers.'

# This description is used to generate tags and improve search results.
Expand Down
19 changes: 10 additions & 9 deletions DBDebugToolkit/Classes/CrashReports/DBCrashReportsToolkit.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,36 +242,37 @@ - (void)saveCrashReportWithName:(NSString *)name
- (BOOL)isRunningUnderDebugger {
#ifndef DEBUG
return NO;
#endif
#else
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).

int junk;
int mib[4];
struct kinfo_proc info;
size_t size;

// Initialize the flags so that, if sysctl fails for some bizarre
// reason, we get a predictable result.

info.kp_proc.p_flag = 0;

// Initialize mib, which tells sysctl the info we want, in this case
// we're looking for information about a specific process ID.

mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();

// Call sysctl.

size = sizeof(info);
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
assert(junk == 0);

// We're being debugged if the P_TRACED flag is set.
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
#endif
}

@end

0 comments on commit 1ddd7d3

Please sign in to comment.