value_of_register think-o bug and so on ...

Andrew Cagney ac131313@cygnus.com
Wed Feb 6 17:15:00 GMT 2002


Hello,

findvar.c:value_of_register() contains:

   get_saved_register (raw_buffer, &optim, &addr,
		      selected_frame, regnum, &lval);

   if (register_cached (regnum) < 0)
     return NULL;		/* register value not available */

I think the test for register_cached(regnum) is wrong.  The value 
returned from get_saved_register() may have been taken from the stack so 
checking the status of the cache isn't correct.

I guess I need to change get_saved_register() and a number of other 
things up the chain to return a register not-available indication.

---

This let me to a bit of a search for where &optim is set.  As best I can 
tell it is only set in one place - dwarf2cfi.c.

Looking at that code:

	case REG_CTX_UNSAVED:
	  read_register_gen (regnum, raw_buffer);
	  if (lval != NULL)
	    *lval = not_lval;
	  if (optimized != NULL)
	    *optimized = 1;
	  break;

can anyone explain why this value was optimized?

Andrew



More information about the Gdb mailing list