Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-debug-dev] About working with memory in debugger

Thomas Fletcher writes:
 > On Wed, 30 Oct 2002, Igor S Zamjatin wrote:
 > 
 > > I'm really sorry but I can't find any mentions about that "undocumented 
 > > commands". 
 > > 
 > > Could you please post here some information about that commands or about 
 > > where can I find it
 > 
 > Igor,
 > 
 >   Not exactly sure what you mean you can't find any mention
 > of undocumented commands, but what I was saying about gdb last
 > time I just verified.  You can set any memory address by:
 > 
 > (gdb) c
 > Continuing.
 > Breakpoint 1, main (argc=1, argv=0x8047af4) at /home/thomasf/cvs/utils/f/fdisk/fdisk.c:213
 > warning: Source file is more recent than executable.
 > 213             disk = NULL;
 > (gdb) p argc
 > $1 = 1
 > (gdb) p &argc
 > $2 = (int *) 0x8047adc
 > (gdb) set *(int *)0x8047adc = 12
 > (gdb) p argc
 > $3 = 12
 > (gdb)
 > 
 > 
 > so all you need to do is construct the right address to pass
 > to the memory "set" MI command.

Please do not use the set command. The command to use, as I already
said in this thread, is in gdb/mi/mi-main.c.  It is sufficiently
commented to be used easily. You invoke it like this:

-data-write-memory ADDR FORMAT WORD-SIZE VALUE


  /* DATA-MEMORY-WRITE:

   COLUMN_OFFSET: optional argument. Must be preceeded by '-o'. The
   offset from the beginning of the memory grid row where the cell to
   be written is.
   ADDR: start address of the row in the memory grid where the memory
   cell is, if OFFSET_COLUMN is specified. Otherwise, the address of
   the location to write to.
   FORMAT: a char indicating format for the ``word''. See 
   the ``x'' command.
   WORD_SIZE: size of each ``word''; 1,2,4, or 8 bytes
   VALUE: value to be written into the memory address.

   Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE).

   Prints nothing. */
enum mi_cmd_result
mi_cmd_data_write_memory (char *command, char **argv, int argc)
{
[...]
}

 > 
 > As far as the work in the IDE with respect to the memory view,
 > you just need to look at the checkins that Mikhail Khodjaiants
 > has been making.  Specificially the Java code is at:
 > 
 > http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/memory/?cvsroot=Tools_Project
 > 
 > Does this help in any way?
 > 
 > Thanks, 
 >  Thomas
 > -------------------------------------------------------------
 > Thomas (toe-mah) Fletcher       QNX Software Systems
 > thomasf@xxxxxxx                 OS Technology Developer
 > (613)-591-0931                  http://www.qnx.com/
 > 
 > 
 > _______________________________________________
 > cdt-debug-dev mailing list
 > cdt-debug-dev@xxxxxxxxxxx
 > http://dev.eclipse.org/mailman/listinfo/cdt-debug-dev


Back to the top