[comp.sys.mips] dbx static class specifier problem

stherien@sobeco.com (s.therien) (03/16/90)

I believe that there is something wrong in the DBX debugger, or it may be
my fault without knowing it. Does anybody know if this is a bug, is it 
documented, or just what am i doing wrong. If there is a documented bug
list for dbx, can someone send it to me. I am running on:

          RISC/os Release 4.3 mips Version UMIPS
          dbx version 2.0

The problem is that i can't access the ptr variable in source file_a.c
and in source file_b.c through the print command if they were declared
as static. Even if i specify the scope of the module for these variables
in the print command, it still does not work. Why does dbx refer to
stdio for the variable ptr ?. Now if i remove the static class specifier
the problem seems to be solved but i still can't access a.ptr and b.ptr .

Here are my samples sources files

     1  /*  sample program to show my dbx problem
     2   *  file_main.c
     3   */
     4  void func_a();
     5  void func_b();
     6  
>    7  main()
     8  {
     9    func_a("Hello");
    10    func_b("world\n");
    11  }
---------------------------------------
     1  
     2   *  file_a.c
     3   */
     4  
>    5  #include <stdio.h>
     6  static char * ptr;
     7  
     8  void func_a(strng)
     9  char * strng;
    10  {
    11    ptr = strng;
    12    printf("%s",ptr);
    13  }
---------------------------------------
     1  
     2  /*  
     3   *  file_b.c
     4   */
>    5  
     6  #include <stdio.h>
     7  static char * ptr;
     8  
     9  void func_b(strng)
    10  char * strng;
    11  {
    12    ptr = strng;
    13    printf("%s",ptr);
    14  }
    15  

---------------------------------------
Here is my sample DBX OUTPUT

[3] stopped at   [func_a:12 ,0x400218] 	printf("%s",ptr);

(DBX) p ptr
[using stdio.ptr]
(nil) 
(DBX) p a.ptr
"ptr" is not defined in a

[4] stopped at   [func_b:13 ,0x400258] 	printf("%s",ptr);

(DBX) p ptr
[using stdio.ptr]
0x10000706 = "world\n" 
(DBX) p b.ptr
"ptr" is not defined in b
---------------------------------------
Remove the static class specifier

change in file_a.c
     6  static char * ptr;
for
     6  char * ptr;

change in file_b.c
     7  static char * ptr;
for
     7  char * ptr;

---------------------------------------
Again my sample DBX OUTPUT without static class specifier

[3] stopped at   [func_a:12 ,0x400218] 	printf("%s",ptr);

(DBX) p ptr
0x10000700 = "Hello" 
(DBX) p a.ptr
"ptr" is not defined in a

[4] stopped at   [func_b:13 ,0x400258] 	printf("%s",ptr);

(DBX) p ptr
0x10000706 = "world\n" 
(DBX) p b.ptr
"ptr" is not defined in b
---------------------------------------

Sylvain Therien
-- 
					Sylvain Therien
					{attcan,mcgill-vision,telly}!sobeco!stherien