0

I want to be able to step through my program but after stepping through a completely function I'm sent through all these files that say CoreFoundation at the top and there's a number of hex address with things I don't understand. Is there any way to bypass this so that I can continue stepping through my program?

I'm trying to understand everything that is going on before a particular UI bug is showing up and I've already spent hours trying to scan the code manually because debugging isn't being much help. I tried profiling the app too thinking I could get a list of functions ran but that didn't work out either. Any suggestions?

Jacksonkr
  • 31,583
  • 39
  • 180
  • 284

1 Answers1

0

Since your program uses CoreFoundation it's going to be stepping through that too. If you want to skip over something then you need to set a subsequent breakpoint immediately after a call that goes elsewhere. You can also try to step over and step out of the code too.

To effectively use a debugger you'll need to learn what those things are you don't understand. If it's too much of a bother then I would recommend asking about the specific bug itself and let someone with more debugging experience try and help you pinpoint the part of your code which seems to be the issue.

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • I use debugging for a number of languages but iOS/obj-c is the only combo that I've ever seen which forces me to step-through their code as well as mine. For example, walking through code in java/eclipse for Android does not make me run through Android libraries before I can step through the rest of my work. I'm pretty sure we can agree on that topic. Anyway, I'm working on an old project and it would be extremely helpful if the xcode/ios debugger wasn't unique in this situation. Is there a way around that besides dumping breakpoints all over the source? – Jacksonkr Mar 12 '15 at 14:46
  • You shouldn't really have to put tons of breakpoints in if you know where the function is you want to debug. If you set the initial `breakpoint` at the function declaration then select `debug` > `debug workflow` > `always show disassembly` you'll see in the second column `call` (likely often). Those are the places you are probably wanting to avoid. Set your `breakpoints` right before and after the `call` - when you hit the one before it the program should stop. Hit `continue`, and the debugger go into CoreFoundation or whatever and land right back where you set the `breakpoint` after it. – l'L'l Mar 12 '15 at 15:08
  • There are some other debuggers and disassemblers available that you might find more intuitive perhaps. Debugging is often not easy, and I can definitely see where you're coming from in the sense you want to cut to the chase. Unfortunately, unless you're an experienced reverse engineer or just very perceptive about how the code is working then much of it requires lots of stepping and setting breakpoints. I think the debugging tools within XCode are quite good really, especially in the sense of how it shows values set on variables, the threads activity, etc. – l'L'l Mar 12 '15 at 15:16
  • Yes, the "disassembly" is what I'm wanting to avoid in hopes that I can go from the end of one of my functions to the beginning of the next that is being called. Reason being again that this is code form a couple of years ago and it's either code I've forgotten writing or code someone else has written. There's so much of it that it would take countless hours for me to walk through everything step by step. Add event handling and it's wasted effort to even try so I'm hoping debugging can help me simplify the process. – Jacksonkr Mar 12 '15 at 16:01
  • Is it one particular area of your code that you're looking to debug, or is it the entire project, and is there an error/crash that you're trying to find? I'm more than happy to give you some pointers that might help you. (or make it a bit more bearable I guess you could say). – l'L'l Mar 12 '15 at 16:10
  • [Here are some pro tips straight from the horses mouth](https://developer.apple.com/videos/enterprise/#8). [Debugging in Xcode 6 / WWDC 2014] – l'L'l Mar 12 '15 at 16:37
  • Ha, alright I'm going to go see what the horse has to say thing. I'm particularly looking to see if there's a duplicate instruction (via NSNotification) that is telling the UI to do something that's already being done. Also this would be helpful for the future anyway. I'll check out your debugging reference and report what I find. – Jacksonkr Mar 12 '15 at 23:15
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/72886/discussion-between-jackson-and-lll). – Jacksonkr Mar 12 '15 at 23:47