This is the mail archive of the gdb-patches@sourceware.cygnus.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]

RFC: Frame cache s not always available.


We are starting to talk about situations where the frames should not
considered valid.  For some oversighting, or maybe because it is
gradually being implemented, gdb only tests for the return value of
get_current_frame() in one place and assumes in several places that
selected_frame is set.

I found two places that are more troublesome and created the attached
patch.  I did implement the frame invalid situation in the arm target
(on my sandbox only) and this two changes alone were enough.  We may
found a few others in the future, and the situation were we do not have
a current or selected frame are not checked in yet, but I believe we
should make the code more robust and check this patch in anyway.



-- 
Fernando Nasser
Red Hat, Inc. - Toronto                 E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299


Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.3
diff -c -p -r1.3 infrun.c
*** infrun.c    2000/02/23 00:25:42     1.3
--- infrun.c    2000/02/23 16:28:57
*************** The same program may be running in anoth
*** 3429,3435 ****
           bpstat_print() contains the logic deciding in detail
           what to print, based on the event(s) that just occurred. */
  
!       if (stop_print_frame)
        {
          int bpstat_ret;
          int source_flag;
--- 3429,3436 ----
           bpstat_print() contains the logic deciding in detail
           what to print, based on the event(s) that just occurred. */
  
!       if (stop_print_frame
!         && selected_frame)
        {
          int bpstat_ret;
          int source_flag;
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.2
diff -c -p -r1.2 stack.c
*** stack.c     2000/02/08 04:39:02     1.2
--- stack.c     2000/02/23 16:28:57
*************** backtrace_command_1 (count_exp, show_loc
*** 1111,1116 ****
--- 1111,1122 ----
       printing.  Second, it must set the variable count to the number
       of frames which we should print, or -1 if all of them.  */
    trailing = get_current_frame ();
+ 
+   /* The target can be in a state where there is no valid frames
+      (e.g., just connected). */
+   if (trailing == NULL)
+     error ("No stack.");
+ 
    trailing_level = 0;
    if (count_exp)
      {

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