This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA] parse_frame_specification (stack.c)


In gdb, if you say:

    "frame <small-number>"
or
    "info frame <small-number>"

then you expect to either move up or down some number of frames or to
get information on the frame having the specified "index".

But, if for your gdb target, addresses and pointers are different,
then the current code in parse_frame_specification will treat the
number as a pointer and convert it to an address.

So, if you have a Harvard architecture processor where a pointer of 0
(say) corresponds to a text address of 0x2000000 and a data address of
0x1000000, and you say

    frame 0

then gdb will try to move to frame 0x1000000.

Assuming you don't have that many frames, it will then try to create a
frame at address 0x1000000.  Which, in my case, will generate an
error...

This fixes it so that

    frame 0

will do the right thing on such configurations.

ChangeLog entry:

	* stack.c (parse_frame_specification): For one argument case,
 	handle the situation where the argument is an integer, not an
 	address -- arguably the most common case.  This matters on
	targets where pointers and addresses are different.

Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.11
diff -c -r1.11 stack.c
*** stack.c	2001/01/27 17:57:53	1.11
--- stack.c	2001/02/06 19:01:15
***************
*** 722,727 ****
--- 722,728 ----
    int numargs = 0;
  #define	MAXARGS	4
    CORE_ADDR args[MAXARGS];
+   int level;
  
    if (frame_exp)
      {
***************
*** 742,747 ****
--- 743,752 ----
  
  	  {
  	    tmp_cleanup = make_cleanup (xfree, addr_string);
+ 
+ 	    if (numargs == 0)
+ 	      level = parse_and_eval_long (addr_string);
+ 
  	    args[numargs++] = parse_and_eval_address (addr_string);
  	    do_cleanups (tmp_cleanup);
  	  }
***************
*** 762,768 ****
        /* NOTREACHED */
      case 1:
        {
- 	int level = args[0];
  	struct frame_info *fid =
  	find_relative_frame (get_current_frame (), &level);
  	struct frame_info *tfid;
--- 767,772 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]