|Apr 19, 2012, 01:03 PM||#1|
EXC_BAD_ACCESS with libssh2?
I was finally able to compile libssh2 (thanks to a very helpful forrst'r), but now I keep seeing the `EXC_BAD_ACCESS` error.
This is the basic background as to how libssh2 works (at least the GUI) is this...
Now, simple commands like `echo Hello World` work fine, but the whole idea of this as a project was to be able to restart my mac remotely. Originally, using the command `shutdown -r` caused nothing to happen on the remote machine, and crashed the app. I then had the idea that I could simple open an applescript app that restarts the mac, by using the `open /path/to/restart.app` command, which works fine. The machine restarts, sweet.
EXCEPT, the app crashes with the following error:
Thread 1: EXC_BAD_ACCESS (code=1, address=_____)
So, I'm guessing that once the command is sent via SSH, it disconnects and then tires to show the result but the object's already gone.
I'd post the source code for this, but it's a lot of different files, so I'll post the github link:
I have not modified any of the code, so if anyone has the desire to replicate my problem, the code I'm using is the same as the one from there.
EDIT: From another forum, "... having said that you can see that libssh2_channel_open() is dereferencing a NULL pointer so you're likely passing one of the parameters as NULL. Stick a breakpoint on your call to libssh2_channel_open_ex() and check the parameters as they go in; alternatively add asserts before the call to ensure things are as you expect (a better longterm solution)." How do I follow these instructions?
|Apr 19, 2012, 02:46 PM||#2|
The issue that needs to be addressed is learning the tools.
Step 1: Use a project that works.
Seriously, learning to use breakpoints and the debugger will be much easier on a program that already works. Since the goal is learning the tools, not debugging a broken program, using a working program takes one problem out of the mix.
Step 2: Learn to use breakpoints.
Start by entering the search term breakpoint in Xcode's builtin documentation. Not the iOS reference docs, the builtin Help documentation for Xcode itself. Learning breakpoints also involves learning how to examine variables and interpret those values. And once a breakpoint is hit, stepping thru code a line at a time is an essential skill.
Step 3: Read online resources.
Found by googling xcode breakpoint site:developer.apple.com
That last site: search term limits the results to that specific site. It's basically how to get site-specific search results without going to the site and doing a search there.
Last edited by chown33; Apr 19, 2012 at 02:51 PM.
|Apr 19, 2012, 06:24 PM||#4|
Thanks for the reply,
1.) I would work on a different project, but I'd like to learn how to debug a semi-working one first.
2.) I'll take a look at the docs and google how to use breakpoints better.
3.) Yes, I normally would search google but I find that when you don't completely understand the language, it's better to hear it from people who are working specifically on what you're working on. And yes, I've searched google like that many a times...
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Resolved: EXC_BAD_ACCESS problem||larswik||iPhone/iPad Programming||0||Jan 27, 2014 08:33 PM|
|Best easy way to debug EXC_BAD_ACCESS code 1||moonman239||iPhone/iPad Programming||25||Nov 6, 2013 11:18 PM|
|EXC_BAD_ACCESS - Trying to retrieve string from NSArray||moonman239||iPhone/iPad Programming||12||Sep 9, 2013 07:06 AM|
|Please Help: EXC_BAD_ACCESS error||stevegreen22||Mac Programming||4||Nov 19, 2012 06:16 PM|
|Getting crazy also with EXC_BAD_ACCESS||jivaro||Mac Programming||5||Jun 1, 2012 08:49 PM|
All times are GMT -5. The time now is 02:34 AM.