Thursday, December 3, 2009

Debugging Note

- gcc
- gdb
- ddd
- xdebug (for PHP)
- cflow (for C)

- GNU GLOBAL 是類似於 ctags 的工具,用以建立 source code 符號定義位置的 database 。除了符號定義之外,global 還建立符號 xref (cross reference) 的 database ,用以快速查詢 xref 的位置,是個很方便的設計。

- ctags

- sTrace

- kTrace

- dtrace (the best)
- FireBug
- yslow
- FirePHP
- kcachegrind:  (Call Graph Viewer)
- Source Code Analysis
- Memory Dump Analysis
- core dump
- stack trace
- back trace

- Debugger
- Disassembler
- Decompiler

- Unit Test
- PHPUnit

- debugging
- tracing
- profiling
- benchmarking

- performance
- optimization

- profiler: Profiling: Objective Analysis "Profiling" means running your code in a controlled environment to see what actually happens, not what you think happens.
- segmentation fault
- Memory leak
- memory corruption
- stack corruption
- IDA Pro
- SoftIce
- Syser Debugger
- Gray Hat Python: Python Programming for Hackers and Reverse Engineers

search: malloc strcat experts-exchange

search: stack, heap (free store)

The Linux Programmer's Toolbox (Paperback) ~ John Fusco

What Every Programmer Should Know About Memory.

Also the SICP lecture videos. – Jared Updike Jun 11 at 23:21

a good understanding of boolean algebra, logic, discrete math, and set theory can really put you up to that next level.

What you need is Computer Architecture and Operating Systems Architecture/Internals/API.

Programming is crap, you learn a programming language in 3 days. Be it ASM, JAVA, C++, C.

And you learn Data Structures in a week and as for Algorithms, the day since you were born. Problem solving that is.

As for proficiency at a programming language it comes only with practice in that particular language and style. But its not really needed, for you as of now. later gain that. its necessary.


1) Get some good grip and develop some good skills in C and C++.
2) After getting some grip on those, start with data structures (Most imp).

After this, It's upto you that on which path you wanna go.
IF you wanna become computer engineer, system developer... follow steps 3 and 4. I dont have much knowledge about it though.
3) If you are computer engineering student you must know Discrete Maths. Study it if you can. try to convert some algos into programs.(Not necessary though but would be better)(don't have idea on books.)
4) Start getting some knowledge on X86 arch. (Refer MSDN for that. x86 Architecture). If you dont have knowledge on assembly/OS then refer some books on introduction, methodologies, characteristics of it

- And IF you wanna become software engineer start learning some serious object oriented programming language like JAVA. If you wanna learn java from scratch, refer Hear First java by kethy sierra. it's very good for beginners.
- You can also study C#and Visual Studio.
- Also Start understanding/mastering OOAD- Object oriented Analysis design.
- Once you finish this you must be able to write code for some good basic/mainstream software as well as be able to design them.
- Take some project to guide your way towards goal. It will help you the most.
- (optional) Pass some certification like SCJP if you want, will help you boost your confidence.


I think what akshay meant to say were that programming languages were a means to an end, as long as you know the stuff that comes before that, there is no need to glorify xyz language and all that.

If you just want to break stuff, you don't even really need to code. Testing is an art all by itself. And a lot more fun too ( breaking stuff is a lot easier than making them ).

Lord Nemesis:

I know a number of people who do programming on a daily basis with out even knowing what a Memory leak or memory corruption or a stack corruption means nor the difference between any of them. They don't know how a program is executed by the processor. They sure know the syntax of the programming language, but without such fundamentals we cannot write efficient and bug free software.


Generally importance of a programming language is over estimated. But here in this thread, I think it's being underestimated. One of the very famous frameworks for creating web applications, which changed the way programmers think about programming web in general and configuration with xml in particular, rails was possible mainly because of ruby. It would have been difficult or impossible in any other language. There have been no of rails clones, nothing came close to it's simplicity, productivity.

Alex Stepanov worked hard on creating a proper implementation for his thoughts on generic programming but couldn't do that partly because of the complexity of implementing his thoughts in a proper programming language until he saw c++ with templates. That with a few changes to the language made it possible for him to realize his thoughts and STL was the result. Read his book "Elements Of Programming" for details.

Creating an operating system or a device driver and yet write parts of the code to be portable requires a good memory model which C offers. Try to express the same stuff in java or c# or python, you will understand why c has the features it has. If you can't read Alex Stepanov's interviews and a few more articles on c's simple memory model.

Algortihms aren't everything. If you need to create a program consisting of thousands or millions of lines of code, you need something more than that. Abstraction mechanisms. That's where a programming language helps. Provides us with abstractions to be able to get to a solution. As Bjarne Stroustrup puts it, "You think in Code". That's what Kernighan suggests in his book "Practice Of Programming".

Choice of programming language doesn't mean everything, but it also cannot mean nothing.


I understand that, that's why i said too. With a practice in particular language you learn more about your tools. you learn to use to sword better only with experience !
but for newbs i never advice to spend all time on just mastering a programming language. you can gain expertise later as you develop.

Lord Nemesis got my point.
For example, am not a master in shell scripting, but i was able to develop them on the fly whenever necessary for my servers, just by reading some man pages and syntax.

We are not Windows API experts, or Linux API an OS Gurus. But still our programs written for Windows and Linux are used by thousands of people !!
I just had to know few basics of win api and windows programming in general to get my ideas into a working program/solution.


My advice in this already very infromative thread... For real programming
-Participate in good programming competitions/projects (ICCC, google summer of code etc)
-Learn to read great programmes, (ever read source code of ls ? great style)
-Participate in mailing lists of gcc, valgrind
-Try to hack hardwares
-HELP OTHERS in coding


Write your own (small) OS...
Probably six months down the line you would know harware, basic OS structure, algorithms, you will learn Assembly , C and one more lang and it will be fun. And it is HARDCORE programming......
Starting point could be Minix (version 1) with a book to guide.

And remember you should not like programming, you should be addicted to problem solving ... If the coding does not keep you awake till 4 in morning and still far from sleep, you are not doing real stuff yet

No comments: