C, C++ NetBeans, gdbserver Debugging Primer Tutorial

C, C++ NetBeans, gdbserver Debugging Primer Tutorial

C, C++ NetBeans, gdbserver Debugging Primer Tutorial

Today’s tutorial is about debugging C (and C++ can be done too) using the gdbserver plugin in the NetBeans IDE, and its progression brought into play issues regarding the upgrade of Xcode 4 to Xcode 5 (and Mac OS 10.7.5 to Mac OS X Mavericks 10.9.1) made here (to facilitate IOS 7 development in Xcode), and the whole scenario has come about as a consequence of Xcode and its Command Line Tools Primer Tutorial in the sense that the installation of Xcode Command Line Tools (in earlier Xcode versions … think maybe less than 4 … “out of the box” it lived with C and C++’s great gcc compiler … have talked about this before … raved perhaps??!!! … anyway … that went away with the later versions … but you can get it back) “closes the circle” on the separation of C and C++, at least as far as NetBeans is concerned, so that we can use the installed Xcode Command Line Tool gcc compiler for C work and use the GNU compiler for C++ in NetBeans … cute, huh?

The bottom line is, when you upgrade from Xcode 4 to Xcode 5 the command line functionality will disappear, but you can resurrect it, and we bring your attention back to the tutorial below and that great link here.

So all this just gets us back to square one with NetBeans, and the first slides of the tutorial may seem a bit irrelevant to gdbserver, but they are showing the restoration of the relationship Xcode and NetBeans can have if the Xcode command line functionality is intact (but read more about this in the tutorial below). By the way this broken record is available on iTunes (chortle, chortle).

Okay, back with debugging for C (and C++ also) in NetBeans using gdbserver. We, in this tutorial, only show (a very simple example of) local debugging, but what about remote debugging (read more here … you might need to research further?) … so thanks to Egor Ushakov for this great plugin.

Debugging in gdbserver or gdb (or most debuggers) uses terminology like breakpoint (place where you stop), watch (find the values in variables and structures), step into (progress forward one line of code), step over (step over some code), continue (let debugger run the code to the next breakpoint) and restart (start the debugging session again). So the sensible first thing before you start a debugging session is to imagine the best place to position that first breakpoint (but bear in mind the program may have other ideas, and that you should be ready for the program to actually lob on a number of different possible places, (especially) if your debug place of interest is well into the execution sequence of your program). Why only worry about the first breakpoint … well, that’s true … set the others if you can … but sometimes you can only do this on getting to that first break, and either/both possibilities of use are okay with gdbserver or gdb or any other debugger I’ve ever seen. You can leave the decision for what you watch to that first breakpoint time, as you wish, also. Anyway, enjoy the tutorial.


Previous relevant Xcode and its Command Line Tools Primer Tutorial is shown below.

Xcode and its Command Line Tools Primer Tutorial

Xcode and its Command Line Tools Primer Tutorial

Xcode is a great GUI IDE application that comes with Macs “out of the box” (quite often). In the earlier versions … think maybe less than 4 … “out of the box” it lived with C and C++’s great gcc compiler … have talked about this before … raved perhaps??!!! … anyway … that went away with the later versions … but you can get it back. Why bother? If you like to look around and do those great command line offerings like Tcl/Tk or just plain simple C (like we do in this tutorial), as well as leaving your Xcode GUI C++ and Objective-C iOS mobile development intact, then think you should install Xcode Command Line Tools, like, yesterday, if you haven’t already.

Remember at the end of the month to say “hares” as your last word and “rabbits” as the first word of the next month.

Do we need to explain?

Butterflies in Brazil and all … why buck what the whole world’s doing? … chortle, chortle.

Anyway, this action opens a pandora’s box of possibilities with your Mac, and hope if you are in this position … you can test if you are by attempting to go gcc at the Mac Terminal bash command line … how’s the coffee? (if PM, how’s the daquiri?)

To get started, visit this stupendous link. Then get into Xcode and go to Xcode->Preferences…->Downloads (and hopefully you see the Command Line Tools install button to press … press with both hands, either hand, while doing a triple pike, but … just … do … it!)

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, NetBeans, Tutorials and tagged , , , , , , , , , . Bookmark the permalink.

24 Responses to C, C++ NetBeans, gdbserver Debugging Primer Tutorial

  1. find says:

    Recognize the value of the blog you available.. Loving the write-up.. thanks a lot Isn’t it amazing once you get an excellent article? I appreciate you showing your point of view..

  2. Youre so cool! I dont suppose Ive read anything such as this prior to. So good to locate somebody with numerous original suggestions on this subject. realy i appreciate you for starting this up. this fabulous internet site is 1 area that is necessary online, someone with a bit of originality. helpful purpose of bringing a new challenge towards internet!

  3. The subsequent time I read a weblog, I hope that it doesnt disappoint me as a good deal as this 1. I mean, I know it was my option to read, but I truly thought youd have something attention-grabbing to say. All I hear can be a bunch of whining about something that you possibly can repair ought to you werent too busy on the lookout for attention.

  4. Wow, wonderful weblog layout! How long have you ever been blogging for? you make blogging look easy. The overall look of your site is excellent, as smartly as the content!

  5. consider says:

    Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I will be subscribing to your feeds and even I achievement you access consistently fast.

  6. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

  7. I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an nervousness over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this hike.

  8. Needed to write you one little bit of remark to be able to thank you yet again for those great suggestions you have featured on this site. It has been quite incredibly generous of you to make easily what exactly a lot of folks would’ve advertised for an e book to earn some profit for their own end, chiefly considering the fact that you could possibly have done it if you considered necessary. Those secrets additionally worked to become a great way to be sure that other people online have the same dreams just as my own to find out a good deal more in respect of this condition. I’m certain there are millions of more enjoyable opportunities up front for those who looked at your blog post.

  9. Genuinely handy viewpoint, thank you for writing.. Honestly very helpful perspective, thank you for sharing.. My personal internet searching seem complete.. thank you. Enjoying the write-up.. thanks much

  10. Look At This says:

    Hi my loved one! I want to say that this article is awesome, nice written and come with approximately all significant infos. I would like to see extra posts like this .|

  11. attract says:

    I was just seeking this information for some time. After 6 hours of continuous Googleing, at last I got it in your web site. I wonder what’s the lack of Google strategy that do not rank this kind of informative websites in top of the list. Generally the top web sites are full of garbage.

  12. drag says:

    Incredibly effective perspective, thank you for posting.. Liking the blog post.. all the best So happy to have discovered this publish.. My internet searching seem complete.. thank you.

  13. You produced some decent points there. I looked on-line for any issue and found most individuals will go in conjunction with along with your website.

  14. I am impressed with this website , quite I am a fan .

  15. There are really lots of details that strategy to consider. This really is a great examine start up. I offer the thoughts above as common inspiration but clearly youรขโ‚ฌโ„ขll locate questions just like the one you raise up exactly where the most critical factor will likely be getting work done in honest very good faith. I don?t know if recommendations have emerged about items like that, but I know that a job is clearly referred to as a good game. Both children glance at the impact of only a momentรขโ‚ฌโ„ขs pleasure, throughout their lives.

  16. Thanks for sharing exceptional informations. Your web-site is really cool. I’m impressed by the details which you have on this web website. It reveals how nicely you perceive this topic. Bookmarked this internet page, will come back for extra articles. You, my pal, ROCK! I found merely the details I already searched all over the place and basically couldn’t come across. What a perfect web-site.

  17. I would like to show my gratitude for your kind-heartedness for those people who must have help with the situation. Your special commitment to getting the message around came to be certainly productive and has permitted guys just like me to arrive at their ambitions. Your entire invaluable help and advice signifies this much a person like me and far more to my office workers. Thanks a lot; from all of us.

  18. Hello! I just wish to give a huge thumbs up for the excellent info youรขโ‚ฌโ„ขve gotten right here on this post. I will likely be coming back to your weblog for far more soon.

  19. I do believe all of the concepts you have introduced in your post. They are very convincing and can definitely work. Nonetheless, the posts are too quick for starters. May just you please lengthen them a bit from next time? Thanks for the post.

  20. There is evidently a lot to know about this. I consider you made various nice points in features also.

  21. you are in point of fact a just right webmaster. The web site loading velocity is incredible. It sort of feels that you are doing any unique trick. In addition, The contents are masterwork. you’ve done a great job in this topic!

  22. marketing says:

    Definitely believe that which you stated. Your favorite reason seemed to be on the internet the easiest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that they plainly don’t know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks

  23. Real excellent info can be found on blog . “Many complain of their memory, few of their judgment.” by Benjamin Franklin.

  24. Una Hyldahl says:

    Excellent goods from you, man. I’ve understand your stuff previous to and you are just extremely wonderful. I really like what you’ve acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still take care of to keep it wise. I cant wait to read far more from you. This is really a terrific site.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>