[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  Stepping through a C codebase
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Stepping through a C codebase

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Npp83   (16 posts)  [Biography] bio
Date Wed 09 Feb 2011 06:21 PM (UTC)
Is there a way to step through a C codebase in a debugger so I can get a feel for where the entry point is? I dont know where a codebase like SMAUG starts - what the entry point is.
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #1 on Wed 09 Feb 2011 07:25 PM (UTC)

Amended on Wed 09 Feb 2011 07:29 PM (UTC) by Nick Cash

They entry point for every C program is the main() function. Go find it and look through the function calls from there.

Or you can take your method and step through the code with a debugger like gdb. Numerous posts on how to do so have been posted in this forum.

More or less you need to compile SMAUG with debugging information and then start SMAUG via gdb. In your Makefile there should be a line for compiler flags. Make sure it has -g or -g3. Then do ./gdb smaug port# and enjoy.

See this post for more details:

Template:post=3653 Please see the forum thread: http://gammon.com.au/forum/?id=3653.

~Nick Cash
[Go to top] top

Posted by Npp83   (16 posts)  [Biography] bio
Date Reply #2 on Wed 09 Feb 2011 08:42 PM (UTC)
Excellent, technical reply. Thank you. My programming began with Java mid 2005 and I found and stayed with C# since 2008 so going back as far as C for me and what tools I have available to mimic some of the things I am used to with VS or Eclipse is difficult.

So then is most debugging (debugging tecnniques in C) with gdb done with console output (seeding the code), is there any means of applying breakpoints?
[Go to top] top

Posted by Nick Gammon   Australia  (21,651 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Wed 09 Feb 2011 09:49 PM (UTC)
Read the link he gave. Another way to get to the same page is:


In there I discuss breakpoints.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]