{video}
A brief introduction to GDB and Assembly Language on Intel processors using the venerable C language and GCC compiler toolchain. This is probably more fun than it is informative (and not even all that fun), but maybe it will give somebody ideas… Documentation: man wprintf man gdb man objdump man hexdump Use pinfo -m instead of man for a nice, colorful interface that can be navigated by clicking or using the arrow keys. Making simple programs and analysing them with a debugger such as GDB is a great way to learn a little bit about assembly language and machine code. Why delve into machine code during an introductory video? Do we realy need to know that the stack grows downward in memory or that the arguments to a function are pushed onto the stack in reverse order, so they can pop back off in the right order? What’s with the wide characters? Why complicate things by adding a function? First of all, functions and assembly are not that hard to grasp. It’s just a push and call. We push an address to something onto the stack and call a function. What’s so difficult about that? I’m sick of people trying to insulate us from the details. Besides, knowing a little bit about what goes on under the hood makes better hackers and better programmers. That’s what we do while learning. We build things and we take them apart to see how they work. I know there is no compelling reason to use wide characters (C90 spec), but I just want to be prepared to understand them when I see them. Yes

Tagged with:  

25 Responses to C Programming, Disassembly, Debugging, Linux, GDB

  1. ThunderAppeal says:

    Very good video, I also get bothered a lot by some of the things I read about C which take for granted that there are people who want to make the connection between the code and how it runs on the machine. The term ‘stack’ is also an abstract concept with relation to what I think you intended with this video. But thats not a big deal, I’m just being really picky I guess. I’ve picked up a C book again recently and found this video when searching for C programming. Very good stuff.

  2. themanyone says:

    @TeenNewsLive I learned by using apropos and reading the man pages for each command and by looking at other people’s programs. Most of the C statements also have man pages. The SciTE text editor, most text editors actually, let you highlight a keyword, press F1, and automatically open a man page for it. Remaining questions were answered by web searches. Use the ##C IRC channel web site but not the chat room. They cater to professionals and have a short fuse when it comes to FAQs.

  3. TeenNewsLive says:

    Where exactly can you learn to do this from please pm me. Really interested but its extremely difficult for me to learn just by watching videos and reading tuts

  4. coilgunner2 says:

    @NawafLol Yeah I love writing C code in Linux, for some reason I just find if funny that I can be writing code to be run on an OS that was made from the same compiler. Even the same version of the compiler if I really wanted to.

    I also have the 0.01 version of the kernel to look over when I’m bored and feel like understanding it a little better.

  5. ZeeManDWeasel says:

    @themanyone
    Any chance of a link to the scite lua scripts you used? Looking for a feature to provide something similar to intellisense in visual studio. pls? :)

  6. NawafLol says:

    C is better and powerful ,you can make a whole operating system with C !

  7. MakarovD says:

    i hate c, basic rulez

  8. 0121ryanh117 says:

    for 64 bit numbers you can use __int64. Just thought id throw that in their.

  9. jayagk says:

    Great video

  10. tunglour says:

    Pfft, this is C. Not damn C#, nothing to do with M$

  11. vincjenzo says:

    Hi,very nice video! Can you make a tutorial on buffer overflows and exploiting them?

  12. themanyone says:

    wchar_t is implementation defined. Windows defines it as 16 bit. Doesn’t really matter though, unless you’re looking at the debugger or maybe doing something you shouldn’t… The pointer (wchar_t *) is of course a 32 bit pointer (or 64 bit pointer on a 64 bit implementation) that points to the (implementation-defined) data type (usually 16 or 32 bits, but could be anything. Only reason I used it was to figure out some other programs that use that data type and compare them to this.

  13. gerbrandt92 says:

    Isnt’ it also 4 bytes on windows? wchars are used for unicode and unucode has quite a lot of characters.

  14. ChaperonNoir says:

    WoW. I am seeing this right but a wide character is 4 bytes on Linux? (32 bits!!)
    What the hell.

  15. themanyone says:

    Thanks. I should have probably mentioned valgrind. It wouldn’t be useful here, but it really helped me sort out those memory and threading errors I get from late night stupidity.

  16. Sotacap says:

    Nice dude! At last someone who uses GDB lol.

  17. ejmarkow says:

    Excellent and helpful…thanks! Can you do some more helpful tutorials? Great stuff.

  18. washumagic says:

    thank you for doing this. love you man.

  19. MindTrip51 says:

    ok, I’ll bite. This is obviously C. Big difference.

    You spelled version wrong.

  20. MrApplication says:

    there are many virsions of c# this is not the c# i know. I know microsoft c#

  21. themanyone says:

    It’s not an IDE. It’s the scite text editor. The LINUX Operating System itself is my Integrated Development Environment (IDE)! I used the Compiz window manager to glue scite and terminal windows together and flip them around in 3D. I also added a bunch of lua script add-ons from the scite lua script page. All free.

  22. shalola5 says:

    please till me what is the name of this IDE

  23. themanyone says:

    ndisasm comes bundled with the Netwide Assembler (nasm) package.

  24. Pablos544 says:

    I used Turbo Debugger a lot in MS-DOS days, gdb is a simple version, command version, and I heard of ELF on Linux, and I can see what you were doing by anti-debugging with hexdump, but what on earth is ndisasm? I didnt get that.

  25. themanyone says:

    I am preparing to crack some anti debugger code.

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>