

The debugger will need the attr_table  and dispatch table. 
for the program, and
the symbolic information that the sys class uses now.

LINE to PC
   function find_line_pc() in symtab.c 
   calls find_line_common()

Machine dependent files:
	opcode.h: defines opcode and instructions.
	param.h: includes the m-machinearch.h files that
	  define lots of necessary machine and operating system
	  macros, constants, paramters, ...
	pinsn.c: defines a disassembler for the current archetecture.
        dep.c: machine dependent routines that inflow.c and core.c use.

Possible modules to break gdb into:

   ptrace handling
	gdb files:
	     inflow.c: low level interface to ptrace.
	             uses dep.c for machine dependencies.
   Core files.
             core.c:
                  interface to use core files. 
	             uses dep.c for machine dependencies.
	 
   Disassembler. Maybe not needed for sather.
             pinsn.c: 
	          disassembler. Uses
	             param.h, opcode.h for machine dependencies.

   Symbol table lookup
	     symtab.c,symtab.h
	     symmisc.c (various things to symbol tables).
	     machine dependencies use by including param.h            
	symseg.h: symbol table format definitions.
        symtab.c,symtab.h (look at his futher).
	findvar.c: lookup variable names in memory.

   Symbol table reading:
	dbxread.c and coffread.c

   Stack frame printing.
	stack.c        manage stack frames.
	blockframe.c   convert between frames, blocks, functions and pc values.
        frame.h: definitions for stack frames.

   Browsing
	integrate sather browser into existing code.

   a.out and coff reading and interpreting
	a.out.gnu.h (like <a.out.h>


   PC <----> function handling
       in symtab.c and blockframe.c

   breakpoints
       breakpoint.c

   Stepping
     infcmd.c

   dealing with inferior process:
       infcmd.c,inferior.h
       (inflow.c is low level access to inferior process).
       (infrun.c is running and stopping the inferior process).


Questions:

How to do breakpoints at sather lines and single step sather
lines?

breakpoints must be specified as:

    className::routineName::lineNum
         lineNum = fileLinenum ?  or
                 = routine offset line num?
    
It might not work to do fileName:lineNum since a given fileName:lineNum
   might correspond to many actual sather source lines once inheritance
   has been done.


Info in man a.out, man nm, <a.out.h>, <stab.h>

How to get multiple sather lines that translate into one C line working?

Do:
    get used to a.out file format.

Files I might need
    defs.h: general definitions.
    obstack.[c,h]: object stack macros (these are data chunks that are
         enlargable until it is "finished").
    printcmd.c: print data in various formats (look over this better).
    regex.c: regular expression handling
    utils.c: general utility routines. 
    xgdb.c: x support. maybe use this for more X things.
        (talk to hws).


Files I probably won't need:

    standalone.c  used for kernel debugging
    stuff.c used for kdb.
    value stuff. (value.h, val*, valarith, valops, valprint, values.c)
    source.c: Source line listing: probably not needed for Sather.
	using this just for openp. Shouldn't need for anything else.
    command.c: command line stuff    
    copying.c: copywright stuff.    
    cplus-dem.c: c++ demangler
    eval.c: evaluate C expressions.    
    expprint.c: print C expressions.
    kdb-start.c: kernel debugger    
    remote.c: commands for remote debugging





------------------------------------------------------------


debugger plans:

DEBUGGER class
  uses or inherites from
	PTRACE
        CORE
        SYMTABREAD        
        STACKFRAMEPRINT
        BROWSING   
        BREAKPOINTS
        STEPPING

minimal commands for debugger.

    run <args>
    ^C
    continue
    break fileName:lineNum  -- set breakpoint at given position
    print <sather expression which could include locals, statics, features>
    up            -- stack frame
    down          -- stack frame
    step <num lines to step>  -- go through function calls
    next <num lines to step>  -- pass funtion calls
    backtrace
    attach <pid>
                
Plan: 

I: First get inferior processes running using A sather class

    starting process
    ^C stopping process

   use only inflow.c which provides the following routines:
     o terminal routines for getting inferior processes output right.
     o create_inferior to create the inferior
     o kill_command() kill the inferior process.
     o inferior_died

   INFLOW class



New idea:

	Keep much of the C code handling in gdb so that when we
	do jump to C files, things will still work.

	add commands for sather debugging that are provided in the browser
	These don't work when debugging C.
	   like:
		visit <feature>  visit an object pointed to by a var
		leave <num> leave the current object
		location  show location in visit stack
	   	array [array spec]  inspect elements of array if current object
			is an array object.
	        show   show all features of current object not including
	                  array portion.
		set debuggingvars ....
		set dvars foo=bar  set debugging variables.
		info dvars
			            

	Add another command class, Sather, to make things work right.	
	create DSYS, DMIRROR, and DBROWSER class.
	



---------------------
to print symbols
	following 
	    print_command() printcmd.c
	    parse_c_expression() in expread.y    
	use:
	   lookup_symbol() in symtab.c for symbol lookup.

	define two functions.
	   lookup_attr_table(i,j)
	   lookup_feat_table(i,j)



Problems:

Problems with gdb.

gdb: virtual memory exhausted.
1.1u 1.2s 1:32r 2% 0t+992d (992tot/78max) 1+1io 235r+4pf+0w


Program control returned to gdb in normal_stop() in infrun.c

Sather C local vars end in __ (is that strong enough condition to use???).
Look at print_block_frame_locals and print_frame_arg_vars in stack.c
to find out how to get values of local vars and arguments.

Next thing to do is breakpoints. !!!

Easy way to have break CLASS::function is just map that name to
the C name, and break at the C function.
