| {\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf120 |
| {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Menlo-Regular;} |
| {\colortbl;\red255\green255\blue255;} |
| \margl1440\margr1440\vieww25580\viewh24980\viewkind0 |
| \deftab720 |
| \pard\pardeftab720\partightenfactor0 |
| |
| \f0\fs24 \cf0 \expnd0\expndtw0\kerning0 |
| Three steps to attach, and debug in Xcode, a /usr/sbin/mDNSResponder that is already running. One caveat, mDNSResponder has to be built and deployed (using step 1 and 2 below) before it can be attached to Xcode.\ |
| \ |
| 1.) First you have to build the Xcode project with symbols included and optimizations off.\ |
| \ |
| a.) From Terminal shell, open mDNSResponder Xcode project from top of tree: \'a0\ |
| \ |
| $ open mDNSMacOSX/mDNSResponder.xcodeproj/\ |
| \ |
| \pard\pardeftab720\partightenfactor0 |
| \cf0 You can also just double click on the project from Finder.\ |
| \ |
| b.) Add your diffs to mDNSResponder project. |
| \f1\fs22 \ |
| \pard\pardeftab720\partightenfactor0 |
| |
| \f0\fs24 \cf0 \ |
| c.) Set Strip Linked Product to No and compiler Optimization Level to None. Below shows changed settings.\ |
| \ |
| \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 |
| \cf0 \kerning1\expnd0\expndtw0 {{\NeXTGraphic Screen Shot 2015-09-16 at 3.36.23 PM.png \width7680 \height460 |
| }¬}\ |
| \ |
| {{\NeXTGraphic Screen Shot 2015-09-16 at 3.46.14 PM.png \width8700 \height460 |
| }¬}\expnd0\expndtw0\kerning0 |
| \ |
| \pard\pardeftab720\partightenfactor0 |
| \cf0 \ |
| d. ) Build mDNSResponder by setting the target to mDNSResponder.\ |
| \ |
| {{\NeXTGraphic unknown.png \width4300 \height800 \noorient |
| }¬}\ |
| \ |
| Then execute\'a0Command-B to build.\ |
| \ |
| \ |
| 2.) Next, deploy newly-created Xcode version.\ |
| \ |
| a.) Go to Terminal shell and type the following: sudo mv \ |
| \ |
| b.) Then drag mDNSResponder from Products list on left side panel (shown below using red arrow) to Terminal shell.\ |
| \ |
| \pard\pardeftab720\partightenfactor0 |
| \cf0 {{\NeXTGraphic 52D711AF-4055-4867-A494-7E31552BB9E1.png \width4420 \height9700 |
| }¬}\pard\pardeftab720\partightenfactor0 |
| \cf0 \ |
| \ |
| c.) Execute command.\ |
| \ |
| For example:\ |
| \ |
| $ sudo mv\'a0/Volumes/iMac\\ HD/Users/llaier/Library/Developer/Xcode/DerivedData/mDNSResponder-fktewmdupxbxrrdlsdljyhmihboz/Build/Products/mDNSResponder\'a0/usr/sbin/mDNSResponder\ |
| \ |
| d.) Restart mDNSResponder by executing the following:\ |
| \ |
| $ sudo killall mDNSResponder\ |
| \pard\pardeftab720\partightenfactor0 |
| |
| \f1\fs22 \cf0 \ |
| \ |
| \pard\pardeftab720\partightenfactor0 |
| |
| \f0\fs24 \cf0 3.) In Xcode, select Debug > Attach to Process > mDNSResponder. |
| \f1\fs22 \ |
| |
| \f0\fs24 \ |
| Now set a breakpoint and try to trigger it.\ |
| } |