Bug 5687

Summary: list ignores frame (and thread?) changes
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Stan Cox <scox>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2246    

Description Andrew Cagney 2008-01-29 04:06:43 UTC
For instance, although this moves between frames, it keeps listing more of a
single file :-(

(fhpd) down
#8 0x08065211 in yyparse () from /bin/bash
(fhpd) list
[0.0]
  2218   {
  2219     int r = 0;
  2220     while (need_here_doc)
  2221       {
  2222         make_here_document (redir_stack[r++]);
  2223         need_here_doc--;
  2224       }
  2225   }
  2226   
  2227   /* When non-zero, an open-brace used to create a group is awaiting a close
  2228      brace partner. */
  2229   static int open_brace_count;
  2230   
  2231   #define command_token_position(token) \
  2232     (((token) == ASSIGNMENT_WORD) || \
  2233      ((token) != SEMI_SEMI && reserved_word_acceptable(token)))
  2234   
  2235   #define assignment_acceptable(token) \
  2236     (command_token_position(token) && ((parser_state & PST_CASEPAT) == 0))
  2237   
(fhpd) down
#9 0x0805ee71 in push_string () from /bin/bash
(fhpd) list
[0.0]
No symbol table is available.
(fhpd) up
#8 0x08065211 in yyparse () from /bin/bash
(fhpd) list
[0.0]
  2238   /* Check to see if TOKEN is a reserved word and return the token
  2239      value if it is. */
  2240   #define CHECK_FOR_RESERVED_WORD(tok) \
  2241     do { \
  2242       if (!dollar_present && !quoted && \
  2243          reserved_word_acceptable (last_read_token)) \
  2244         { \
  2245          int i; \
  2246          for (i = 0; word_token_alist[i].word != (char *)NULL; i++) \
  2247            if (STREQ (tok, word_token_alist[i].word)) \
  2248              { \
  2249                if ((parser_state & PST_CASEPAT) &&
(word_token_alist[i].token != ESAC)) \
  2250                  break; \
  2251                if (word_token_alist[i].token == TIME &&
time_command_acceptable () == 0) \
  2252                  break; \
  2253                if (word_token_alist[i].token == ESAC) \
  2254                  parser_state &= ~(PST_CASEPAT|PST_CASESTMT); \
  2255                else if (word_token_alist[i].token == CASE) \
  2256                  parser_state |= PST_CASESTMT; \
  2257                else if (word_token_alist[i].token == COND_END) \
(fhpd) up
#7 0x08065211 in yylex() /usr/src/debug/bash-3.2/./parse.y#2208 [inline]
(fhpd) list
[0.0]
  2258                  parser_state &= ~(PST_CONDCMD|PST_CONDEXPR); \
  2259                else if (word_token_alist[i].token == COND_START) \
  2260                  parser_state |= PST_CONDCMD; \
  2261                else if (word_token_alist[i].token == '{') \
  2262                  open_brace_count++; \
  2263                else if (word_token_alist[i].token == '}' &&
open_brace_count) \
  2264                  open_brace_count--; \
  2265                return (word_token_alist[i].token); \
  2266              } \
  2267         } \
  2268     } while (0)
  2269   
  2270   #if defined (ALIAS)
  2271   
  2272       /* OK, we have a token.  Let's try to alias expand it, if (and only if)
  2273          it's eligible.
  2274   
  2275          It is eligible for expansion if EXPAND_ALIASES is set, and
  2276          the token is unquoted and the last token read was a command
  2277          separator (or expand_next_token is set), and we are currently
(fhpd)
Comment 1 Andrew Cagney 2008-02-06 19:37:32 UTC
For the moment the "smart" where list tries to (it can't it doesn't have
sufficient information) remember where it last was should be removed.

We can think about how repeat should work in general later.
Comment 2 Stan Cox 2008-02-07 03:42:25 UTC
How about this?

List around the PC whenever the frame changes.
    
* ListCommand.java (currentFrame): New.
(interpret): Use it.

(fhpd) where
#0 0x00000000004006d8 in loop_(double d1,int i1,int i2,short int s,int i3,float
f,double d2,int i4,int i5) /home/scox/accu/src/loop_.c#8
#1 0x000000000040062f in func_2(int x,int y) /home/scox/accu/src/loop.c#54
#2 0x0000000000400681 in func_1(int x,int y) /home/scox/accu/src/loop.c#68
#3 0x00000000004006ab in main(int argc,char ** argv) /home/scox/accu/src/loop.c#76
#4 0x000000375801dab4 in __libc_start_main () from /lib64/libc-2.6.so
#5 0x0000000000400399 in _start () from /home/scox/accu/src/loop.x
(fhpd) list
[0.0]
...
     7   {
->   8     return 2;
     9   }
...
(fhpd) down
#1 0x000000000040062f in func_2(int x,int y) /home/scox/accu/src/loop.c#54
(fhpd) list
[0.0]
...
    53     
->  54     int_21 = loop_(class_p->class_double_1,*int_p, int_22, short_21,
    55                   int_21, float_21,double_21,x,y);
...
(fhpd) list
[0.0]
    64   func_1 (int x, int y)
    65   {
    66      int int_21 = 21;
    67      int int_11 = 12;
    68     return func_2 (int_21, int_11);
    69   }
...
(fhpd) up
#0 0x00000000004006d8 in loop_(double d1,int i1,int i2,short int s,int i3,float
f,double d2,int i4,int i5) /home/scox/accu/src/loop_.c#8
(fhpd) list
[0.0]
...
     7   {
->   8     return 2;
     9   }
...
(fhpd) 
Comment 3 Stan Cox 2008-03-18 19:09:20 UTC
The test testListFrames now checks this.

* TestListCommand.java (testListPC): Set breakpoint via line number.
Tighten up expect checks.
(testListFrames): Likewise.