• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Am I Being Debugged?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Am I Being Debugged?


  • Subject: Re: Am I Being Debugged?
  • From: glenn andreas <email@hidden>
  • Date: Mon, 8 Oct 2007 16:10:51 -0500


On Oct 8, 2007, at 3:12 PM, Michael Crawford wrote:
Is there an API that allows an application to know that
it's being run under GDB?


#include <sys/sysctl.h>
#include <unistd.h>

    int mib[4];
    size_t bufSize = 0;
    int local_error = 0;
    struct kinfo_proc kp;


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


bufSize = sizeof (kp); if ((local_error = sysctl(mib, 4, &kp, &bufSize, NULL, 0)) < 0) { fprintf(stderr,"Failure calling sysctl"); } else if (kp.kp_proc.p_flag & P_TRACED) { printf ("I am traced\n"); } else { printf ("I am not traced\n"); }


Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Am I Being Debugged?
      • From: Steve Checkoway <email@hidden>
References: 
 >Am I Being Debugged? (From: "Michael Crawford" <email@hidden>)

  • Prev by Date: Am I Being Debugged?
  • Next by Date: Regexp search and replace spanning multiple lines
  • Previous by thread: Am I Being Debugged?
  • Next by thread: Re: Am I Being Debugged?
  • Index(es):
    • Date
    • Thread