Author Topic: Strange sentence  (Read 9365 times)

Offline dbfn

  • Jr. Member
  • *
  • Posts: 17
Strange sentence
« on: February 02, 2010, 12:01:08 AM »
Ok,so I was in a programming forum and a dude said "analise in assembler..." refering to debug a program.
As this dude doesn't believe me,I would like you,the developers of an assembler,to say if this sentence is correct...
« Last Edit: February 02, 2010, 12:03:16 AM by dbfn »

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Strange sentence
« Reply #1 on: February 02, 2010, 03:49:40 AM »
To "analyze in assembly language" can be one way of "debugging" a program, albeit difficult unless you are looking at the original source code. When running through disassembly dumps, you can think of yourself as the "debugger" (in human form) in the same way that you are the "compiler" (in human form) when developing in assembly language.

At times, I do run object/binary files through Agner Fog's OBJCONV, and dump it out to NASM format, to see if I can isolate any specific/obvious issues.

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: Strange sentence
« Reply #2 on: February 02, 2010, 07:54:52 PM »
My general debugging process is to dump a listing of the file then walk through it to make sure what I'm wanting to generate is being generated, then I use strace to make sure system call arguments and return values are correct, finally I throw the code in GDB and step to various INT 3 breakpoints I've put in the code and monitor the registry. I almost never worry about the disassembler unless I'm getting a seg-fault, in which case I disassemble to see what instruction it's happening on.

On windows it's a bit of a different story, I like developing in the command line and I don't have GDB on that box. So I do actually use the "mental execution" process that Keith mentioned. That works until something really obscure happens and it forces me to step out of the command prompt and load up OllyDBG. Even with "mental execution" I still prefer to go by listing files than disassembler dumps because they give a much clearer output to read.

As far as the correctness of his sentence... I would have probably used the term "source profiling" instead, but I'm not one to argue semantics like that. As far as it being an integral part of the debugging process, I put it on the level of DBGPRINT macros like:

Code: [Select]
%macro STRING 2
[SECTION .data]
str %+ %1 DB %2
str %+ %1 %+ .Size EQU ($-str %+ %1)
__SECT__
%endm

%macro DBGPRINT 1-*
%ifdef __DEBUG__
%push _DBGPRINT_
Push Edx
Push Ecx
Push Ebx
Push Eax
%ifstr %1
STRING %%tmp, %1
Mov Edx, str %+ %%tmp %+ .Size
Mov Ecx, str %+ %%tmp
Mov Ebx, STDOUT_FILENO
Mov Eax, SYS_WRITE
Int 80h
%elifnum %1
STRING %%tmp, %1
Mov Edx, str %+ %%tmp %+ .Size
Mov Ecx, str %+ %%tmp
Mov Ebx, STDOUT_FILENO
Mov Eax, SYS_WRITE
Int 80h
%endif
Pop Eax
Pop Ebx
Pop Ecx
Pop Edx
%pop
%endif
%endm

Where you throw in comments to be displayed during runtime to track down where an application is having problems. Yea, it's useful but it's still better just to throw an INT3 in there and run it through a debugger. Same goes for "mental execution", it's good for tracking down program flow errors, but most decent debuggers can help you far better by simply stepping through the program's execution.

About Bryant Keller
bkeller@about.me

Offline dbfn

  • Jr. Member
  • *
  • Posts: 17
Re: Strange sentence
« Reply #3 on: February 02, 2010, 11:22:19 PM »
Hi...
In the beggining it was supposed just to say if the sentence were correct or not,but it took such a path...
You guys are awesome!
Pretty intersting thinks what you posted...o-o
Speaking of wich...Keith...where's the dynatOS source? o-o
And bryant...you could release some projects sources...o-o

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Strange sentence
« Reply #4 on: February 03, 2010, 03:19:03 AM »
Speaking of wich...Keith...where's the dynatOS source? o-o

If you are talking about the 32-bit version, I removed that from SourceForge and don't have any other repositories.

If you are talking about the 64-bit (current) version, it is closed-source at the moment.

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: Strange sentence
« Reply #5 on: February 03, 2010, 05:14:04 AM »
As for me, the reason I've not been releasing any new projects is because I've been working on finishing up my courses. This means I have to restrict my side projects down to just one or two tops. Currently on my plate I'm focused on gathering material and writing sample code for a Linux NASM document series covering basic console programming, X-Windows, 2D graphics, and ending with LKM's (also showing other things like modem/network i/o and various math algos). Tbh, it's a fairly big project and I've been working on it for a while. Even still, I don't see it being released any time real soon.

About Bryant Keller
bkeller@about.me

Offline dbfn

  • Jr. Member
  • *
  • Posts: 17
Re: Strange sentence
« Reply #6 on: February 03, 2010, 10:34:20 PM »
Quote
If you are talking about the 32-bit version, I removed that from SourceForge and don't have any other repositories.
Why did you remove? o-o
---
Hum...at least when I get in the University (I hope...: |) there'll be some damn good material around...: p

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Strange sentence
« Reply #7 on: February 04, 2010, 02:18:24 AM »
Quote
If you are talking about the 32-bit version, I removed that from SourceForge and don't have any other repositories.
Why did you remove? o-o
---
Hum...at least when I get in the University (I hope...: |) there'll be some damn good material around...: p

1.) There was nothing much to it, that the source code of other operating systems don't already cover.

2.) I have no intention of continuing the 32-bit version before a solid 64-bit version is developed, if at all.

Offline dbfn

  • Jr. Member
  • *
  • Posts: 17
Re: Strange sentence
« Reply #8 on: February 04, 2010, 04:18:11 PM »
I don't think so.
You could release the sources [-again].

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Strange sentence
« Reply #9 on: February 05, 2010, 05:41:57 AM »
I don't think so.
You could release the sources [-again].

Well, I don't intend to release that source again.

However, if you want the source (to the 32-bit version) please contact me via the PM (Personal Messaging) system here and I can make arrangements.

Offline JoeCoder

  • Jr. Member
  • *
  • Posts: 72
  • Country: by
Re: Strange sentence
« Reply #10 on: June 23, 2011, 08:53:33 AM »
Ok,so I was in a programming forum and a dude said "analise in assembler..." refering to debug a program.
As this dude doesn't believe me,I would like you,the developers of an assembler,to say if this sentence is correct...

Only two years after you posted but since not much new updates on this site and I have two minutes to spare:

I am an assembler developer but once in a while I have to deal with HLL issues, usually interoperation or when something breaks and somebody asks me for help. Well one time somebody came to me with ugly, ugly C++ code (is there any other kind?) and asked me to help because he had a very severe problem he couldn't figure out and his whole product would not go throw acceptance because of a serious runtime bug. I have no hope of figuring out C++ problems that somebody who writes C++ for his job can't figure out...in C++. So I got the idea to generate the assembler listing of the code that was having the problem, and sure enough in about 10 minutes I saw the problem and explained it enough so he was able to fix it. You could say "I analyzed it in assembly"

It just goes to show you if you know assembler/assembly and your environment good enough you can debug anything as long as you have the object code or a way to get it.
« Last Edit: June 23, 2011, 08:55:10 AM by JoeCoder »
If you can't code it in assembly, it can't be coded!