Generating a state diagram from legacy C code - c

I'm looking into visualizing a large amount of C code, preferably having its state machine reverse engineered and graphed out for me diagrammatically.
I've looked into Graphviz and Dot, and it appears that I could probably stitch something together from the API to do the job. But honestly I kind of expected that it would have been a common enough task that someone may have already come up with a tool to do the task.
Does anyone have experience with this? Any solutions you can recommend or tools that exist that I've overlooked?
Thank you.

You can try the Enterprise Architect but that's really not a good idea and in any case you'll need to do a lot of manual changes to the result. It's more or less like relying on an automatic translator to speak for you in the language you don't know. It's especially problematic for procedural type of code, like you probably have if it's in C.

Related

How to prevent an applications DLL to be decompiled?

As I know there are some applications that decompile DLLs to get source codes from application files.
Not only I don't want others to have the sources but also I don't want others to use them, I mean the DLL files. so how should i lock the DLLs and how safe they are ?
Before I get into anything else, I will state that it is impossible to protect your application entirely.
That being said, you can still make things more difficult. There are many obfuscators out there that will help you make it more difficult for someone to decompile your application and understand it.
http://en.wikipedia.org/wiki/List_of_obfuscators_for_.NET
.NET obfuscation tools/strategy
That's truly the best you can hope for.
Personally, I really wouldn't bother going too deep, if at all. You'll find that you are either spending too much money or time (or both) trying to protect your application from no-gooders. These are the same people who, no matter what barriers you throw up at them, will continue to try and given the nature of managed languages, they will most likely succeed. In fact, most obfuscators can be deobfuscated with simple tools... In the meantime, you've let other important features and bug fixes slip by because you spent more time and effort on security measures.
Obfuscation is one way to protect your code. Again, the solution is relative as per your needs. If you have a super secretive program, then you would want to explore more expensive and in-dept strategies.
However, if you are developing a business application or such thing which would not be worth a lot of any hacker's time to reverse engineer, minimal to normal obfuscation strategies are good enough. As the main answer suggests, look at those links.
Recently, I came upon ConfuseEx, a free open-source obfuscator that does the job for WPF apps and more. It seems to be very powerful, effective and customizable.
ConfuseEx on Github
For DLLs there is almost nothing we can do , confusing the files is the best way , but public member will remain in the way they were before , but if you pack them in your exe file , and confuse them , no one can use them easily .
I used ConfuserEX and it was very easy to use and effective .

CodeSmith Insight vs FogBugz BugScout

Both Codesmith and FogBugz have tools for automated error reporting. FogBugz has BugzScout and Codesmith has Insight
I am looking for feedback from people who have tried both of these tools so I can learn the pluses and minuses of each. I want to do automatic error reporting from WPF applications.
I have used the FogBugz thing and it's pretty primitive. You just make some XML yourself (they have some C# example code that you can hack (I had to convert it to Java), and this code files a bug report. They do have some means of checking for duplicates so that's nice, but there is little more to it. It's just a little add on to FogBugz.
I love Fogbugz as a bug tracking system, but as a case management system (which this is related to) there are other better systems out there, and Fog Creek does not seem to be interested in improving these capabilities (we actually use Zendesk for the case handling, and have automatic submission to that for support requests).
I have not used Insight, but in looking at their comparison it appears that they are making this a big part of their product and have a lot more features; this is a real product by itself, so I would certainly take it very seriously.
In the same category of services that help you to track .NET exceptions would be ExceptionTail.
Take a look at the following answer to a similar question https://stackoverflow.com/a/6562756

Getting started with GraphicsMagick

I find the (C) API to be very complicated, there are many functions which sound like that they are doing the same thing. The relationship between blob<->image<->registry<->streams> confuses me.
Has anyone found tutorials or can otherwise shed light on what the fundamental concepts of GraphicsMagick are? A few typical workflows like "if you want to work with an image in memory, you can do [...], then to write it to disk, do [...]"
Simple tasks like this are hard.
Probably you have already overcome your problem, but if not- I think that C++ API for GraphicsMagick is quite simple to use in terms that you have specified, see documentation. So if C++ is acceptable for you, it is quite reasonable option.

Interesting examples of Domain Specific Languages

I'm considering doing something with Domain Specific Languages for my undergraduate project. My one problem is I can't really find any interesting examples that I can root around in. Does anyone have any good examples of DSELs (preferably open source)?
Also, one area I would love to look at is solving/addressing concurrency problems (coroutines etc) with DSEL's. Are there any good examples that anyone uses of this in DSELs? If this is a stupid application of DSELs please explain why...
Another potential area to explore would database programming. Again is this a stupid area to explore with DSEL's. For example, would adding some crazy database manipulation syntax to C# say be a good project to undertake?
EDIT: General languages I would be looking at implementing in would be Java, Python, Scala, C# etc. Probably not C++ or C.
Linda implementations can be considered as eDSLs. STM implementations like CL-STM are certainly eDSLs.
Unrelated to concurrency, but extremely useful are embedded Prolog implementations, there are plenty of them for Scheme, Lisp and Clojure. Parsing eDSLs had been mentioned already - and their patriarch Parsec definitely worth digging into.
EDIT: with your list of implementation languages you're missing the most interesting eDSL opportunities. The most powerful and flexible eDSLs are made with metaprogramming. Scala-style (or even Haskell-style) eDSLs are based on high order functions, i.e., on mini-interpreters. They're more complicated in design, much less flexible and limited to the syntax of your host language.
boost::spirit if you're after C++ is an interesting example. Quote:
Spirit is a set of C++ libraries for
parsing and output generation
implemented as Domain Specific
Embedded Languages (DSEL)...
(I have no idea what you mean by "solving concurrency" though. I don't see how you can solve "concurrency problems" in general, or how a DSEL could help.)

What are some practical projects to consider in trying to learn C?

I've seen a lot of questions and answers on SO about why I should learn C. I know that it's low level, it'll give me an understanding of how things work at that level, and it'll make me a better programmer. I know some good books to be reading to help me learn C.
What I don't feel like I know are some practical projects I can work on to help me learn how the language is used. There's a lot of examples in the books I'm reading, and they're absolutely useful as far as reinforcing knowledge gained about the language itself. But I don't feel as if I'm gaining any insight into "real life" examples of what I can do with C.
My background: I'm a recent college grad who's doing application programming in C#. I'm enjoying doing programming exercises in C -- but I just feel like they're exercises. I know obviously I'm not going to become an expert right away and start doing amazing things. I just want some ideas for things I can do to help me become better but that feel like more than just exercises. (I want to clarify that I'm not opposed to doing these kinds of tasks to help me learn about the language. I just think I'd get more excited about learning if I was doing something that seemed more practical in nature.)
If this is "not a real question," I truly do apologize, and I know questions about learning C are all over SO. I'm not trying to be repetitive. I'm sold on the idea that I should learn the language, I just want to be able to have some real ideas of how I can start applying the knowledge.
See Also
What is a good first C app to build, besides “Hello World”
Here's some ideas for you to try:
Store a file containing hashes of every file in your music directory, and report on changes.
Solve a Sudoku in the shortest possible time.
Send a file using TCP to another computer. (Write both server and client).
A program that broadcasts a list of public files (configured in a text file) over UDP, and then accepts TCP connections to download them.
A command line POP3 client.
Write a memory allocator, and hook into malloc.
Congratulations on deciding to learn C. It is the most powerful language on Earth, and will give you the foundation you need to kick some programming butt.
The way to learn C would be to try out POSIX compliant samples from any operating system book.
My seven step guide to finding something code wise to do :)
find something you like or enjoy(preferably IT related)
find a problem with it, or some way to improve it, else goto Step 1
split the problem into logical parts, these will represent functions and structures, use a piece of paper if it helps you visualize the problem(this is what I some times do)
devise your plan of attack, ie: how will you implement what you came up with in Step 3
Code, Learn, Test, Learn, Debug, Learn, Improve, Learn and Code & Learn some more
Done, but not really, this is when you review what you've made, marvel in all its glory, and learn from all its mistakes and problems. see what parts you enjoyed, what parts you hated and what parts you can still learn more from.
goto Step 1, using the knowledge gained from Step 6 (and all the other steps along the way)
If you run out of things to do and want to be productive in a commercial sense, see if you can talk to people who work with computers/IT systems/etc as a daily occurrence in their job and see what happens them and try develop ideas that could improve their productivity and/or the ease with which they can perform their task(s), who knows, you may end up with some extra knowledge and some extra cash
See what are the things you enjoy doing in real life and try to use them in an application. For example if you like games, try to make a game or if you need an idea, remake a classic. If you like accounting, try to make an accounting application with a proper interface. If you are not passionate about the idea, then you'll probably get tired after a while and throw it away.
BTW, I think you're on a good path and I like the decisions you have made so far.
Write a compiler for a subset-of-C.
There are some Artificial Intelligence competitions that are both practical and fun. These will help you learn the language, encourage your understanding of any sample code, basic debugging and implementation of common algorithms.
Most importantly it's fun, so it keep will keep you motivated to keep learning.
For instance a few months ago I enjoyed the Google AI challenge: http://csclub.uwaterloo.ca/contest/
Good luck and enjoy :)

Resources