LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices



Reply
 
Search this Thread
Old 03-14-2014, 04:08 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Rep: Reputation: 49
DEBUG.EXE: the machine at your fingertips.


For one with a feel for basic things, one of the great things in MS-DOS was the ability to enter into direct contact with the inner workings of the machine through DEBUG.EXE with almost no learning curve at all. All that was needed was a knowledge of the x86 instruction set (plus a few commands). And you could see memory dumps and machine code almost at once! You could even disassemble the BIOS.

Anything like this in present day software? The answer is a plain no, I know. So what do I mean by this question? Only two things: is there among software produced by the linux community a debugger satisfying both the conditions of utmost usage simplicity and the bare capacity to let you see code anywhere in memory?

Last edited by stf92; 03-15-2014 at 09:21 PM.
 
Old 03-14-2014, 05:22 PM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
My personal favorite was the debugger and the Integer Basic interpreter that were all crammed into the Apple ][. I also enjoy playing with my Apple-1 and KIM-1.

No, the only way today to "have the machine at your fingertips" is with a virtual machine ... or something like a CP/M or DOS emulator. I, too, miss those glory days.
 
Old 03-14-2014, 05:51 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
That makes two of us! By the way, how do I cp a lot of files without CRT output?

EDIT:
Had the Apple hard disk a absolute 0 sector analogous to the MBR?

Last edited by stf92; 03-14-2014 at 05:54 PM.
 
Old 03-14-2014, 06:00 PM   #4
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,526

Rep: Reputation: Disabled
Trying to see anywhere in memory would lead to a segfault, and thank goodness and protected mode for that.
 
Old 03-14-2014, 06:37 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
That's the point. No segfaults, no processor exceptions, absolute rule! You could even read or write the MBR (sector absolute number zero), with 5 DEBUG.EXE instructions for making a backup or restore your MBR.

Protected mode was the beginning of the debacle. After that, we all lie slaves to the machine, which decides by herself what can be done and what cannot be done.

Last edited by stf92; 03-14-2014 at 06:40 PM.
 
Old 03-15-2014, 01:48 AM   #6
enorbet
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 14 is Main OpSys on Main PC, 2ndary are OpenSuSe 13 and SolydK
Posts: 731

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Greetz
Well, actually those days aren't dead. You still can. FreeDOS has DebugX which is 32bit. That shouldn't be too awful surprising when Debug.exe was essentially just scaled down Assembly.
 
Old 03-15-2014, 02:39 AM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
Yeah... today I was curious and typed in DEBUG in the DOS prompt (Freedos): and there it was! I used to write:

>A
0100 MOV AX,0102
0103 MOV BX,200
0106 MOV CX,0
0109 MOV DX,0080
010C INT 13
010E
>G10E

and there I was reading the MBR. To write a backup onto sector 0, I could not used the DEBUG commands, for they were dependent on DOS int 21h, which did not access track 0. But BIOS did, of course! So loading the backup into memory with a DEBUG command, then the same five machine instructions wrote the backup onto sector 0, changing MOV AX,0102 for MOV AX,0103. Why use any other thing? That is the name of simplicity.

So DEBUG.exe was written in assembly? Easy to imagine. I have a MASM 6.11 in a CD-ROM. Microsoft of Argentina gave it to me for free, as I was telling them I wanted to write some driver using 32 bits. Finally, I must have emptied there patience, and they sent me the 32-bit assembler home. But I discovered it did not include the linker!

Last edited by stf92; 03-15-2014 at 05:47 AM.
 
Old 03-15-2014, 03:55 AM   #8
enorbet
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 14 is Main OpSys on Main PC, 2ndary are OpenSuSe 13 and SolydK
Posts: 731

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Quote:
Originally Posted by stf92 View Post
Yeah... today I was curious and typed in DEBUG in the DOS prompt (Freedos): and there it was! I used to write:

>A
0100 MOV AX,0102
0103 MOV BX,200
0106 MOV CX,0
0109 MOV DX,0080
010C INT 13
010E
>G10E

and there I was reading the MBR. To write a backup onto sector 0, I could not used the DEBUG commands, for they were dependent on DOS int 21h, which did not access track 0. But BIOS did, of course! So loading the backup into memory with a DEBUG command, then the same five machine instructions wrote the backup onto sector 0, changing MOV AX,0102 for MOV AX,0103. Why use any other thing? That is the name of simplicity.

So DEBUG.exe was written in assembly? Easy to imagine. I have a MASM 6.11 in a CD-ROM. Microsoft of Argentina gave it to me for free, as I was telling them I wanted to write some driver using 32 bits. Finally, I must have emptied there patience, and I walked away with my 32-bit assembler. But I discovered it did not include the linker!
It's not just written in Assembly. It IS Assembly, or at least one iteration of it. MOV, ADD, SUB, JMP etc are all examples of Assembly Instructions. H E R E is a site with a list of free Assemblers and Linkers. Note that Linux gcc has some capability for linking assembly code but there are also really good, really free linkers for both 32bit and 64bit. It's nice that you got that version free but v8 is free at the above link, although NASM is probably a better choice for Linux. Even better, you already know all the basics from using Debug!
 
Old 03-15-2014, 05:39 AM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
The basics and something else (thanks for the links). I remember when using the 586 (the breakthrough to 32 bits was in the 386 I think to remember) the "enormous" width of the code column in the listings. When I plunged into the 586 Intel manuals, I was amazed by seeing that CPU was like a universe in itself! So complex and extensive it was. I had made a great effort to understand protected mode in the 286, the great initiator, and had tried my hand writting some programs which just allocated and wrote the tables and had even played with the interrupt descriptor tables (IDT). In short, it was great fun, but to keep with the enormous complexity of the Pentium I was just too much. Of course it was downwards compatible with even the 8086/88, just as the Intel processor in the machine I bought a year ago is.

In Linux I've used plain as, the GNU assembler, but that was a long time ago. And I even made my first steps with gbd. A pity I left it. Instructions such as MOV, ADD, SUB and JMP are the very mnemonics used by Intel in the x86 CPU programmer's reference library and in the hardware reference. They are called machine code or just instructions.

The 8086, and the 8088, the 8-bit hardware brother of the former, the 8086 having a 16-bit wide data bus, and being the first Intel processor that went into the IBM PC, had instructions to perform division and multiplication. The IDIV instruction, in its memory-word version, executed in 59-67 clock cycles, with each clock cycle = 500ns. The x86 Intel processor I have now in my machine, a direct descendent of the 8086 and downwards compatible with it, executes that instruction for quadruple the memory-word size in only at most 4 clocks with each clock = 1/2.60GHz = 0.38ns
when running at full speed. This is a long way from the IBM XT Personal Computer (which really ran at some 3.8MHz) and an improvement by a factor of nearly 4000 in speed. However, the difference between a bad algorithm and a good one, it could be the case that it were ten to the power of a thousand or make the computer run for as long as the age of the universe [the universe is infinitely younger than that]. I could give concrete examples of this but the length of this post menaces with reaching astronimical figures as well. So, glad to meet you and until the next one.

Last edited by stf92; 03-15-2014 at 05:42 AM.
 
Old 03-15-2014, 06:49 PM   #10
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,984

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
Quote:
Originally Posted by stf92 View Post
That's the point. No segfaults, no processor exceptions, absolute rule! You could even read or write the MBR (sector absolute number zero), with 5 DEBUG.EXE instructions for making a backup or restore your MBR.

Protected mode was the beginning of the debacle. After that, we all lie slaves to the machine, which decides by herself what can be done and what cannot be done.
Modern operating systems, as you acknowledge in your second paragraph, are designed specifically to not allow that. If this is the kind of programming you want to do, get a microprocessor or microcontroller. Or run FreeDOS, I guess.

The kinds of debuggers that bypass that are used, on Windows, mainly by blackhats wanting to break software copy protection.

Last edited by dugan; 03-15-2014 at 06:50 PM.
 
Old 03-15-2014, 07:03 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by dugan View Post
Modern operating systems, as you acknowledge in your second paragraph, are designed specifically to not allow that. If this is the kind of programming you want to do, get a microprocessor or microcontroller. Or run FreeDOS, I guess.

The kinds of debuggers that bypass that are used, on Windows, mainly by blackhats wanting to break software copy protection.
Let me tell you, the revolution was initiated by the hardware, not the software. It was in the microprocessor field that protected mode was born. And, alas, a microcontroller is a very different thing from a microprocessor. This, is a CPU. The former, is only a computer altogether put in a single chip. And notice I say 'only'. I do not like microcontrollers, though it seems they will come to dominate the world.

Last edited by stf92; 03-15-2014 at 07:09 PM.
 
Old 03-15-2014, 08:28 PM   #12
jefro
Guru
 
Registered: Mar 2008
Posts: 12,084

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
When I worked at (big computer place) we used debug to get into all sorts of stuff. It was still a great tool even into much later OS's. Debug really could get into almost any part of the system that few other apps could. I know of no linux app or way to get to some of the stuff.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
replacement for debug.exe? ultagod Programming 5 10-24-2011 12:20 PM
debug\*.exe not found threaderslash Programming 3 09-18-2009 12:00 AM
samba compatibility with microsoft srvtools.exe (usrmgr.exe and srvmgr.exe) checkmate3001 Linux - Software 1 09-06-2008 06:08 AM
Debug WinXP machine with bootable Linux CD shuuhen Linux - General 1 11-21-2005 12:27 AM


All times are GMT -5. The time now is 01:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration