home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / gdb / bug / 976 < prev    next >
Encoding:
Text File  |  1992-08-14  |  3.4 KB  |  127 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
  3. From: pfieland@citron.sw.stratus.com (Peggy Fieland)
  4. Subject: (none)
  5. Message-ID: <9208132015.AA15955@citron.sw.stratus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 13 Aug 1992 20:15:15 GMT
  10. Approved: bug-gdb@prep.ai.mit.edu
  11. Lines: 114
  12.  
  13. On a stratus i860, using gdb-4.6 and cfront, gdb does not correctly
  14. demangle the name of the operator when printing an error message
  15. when trying to set a breakpoint on an operator that is NOT a
  16. member of a class.  
  17.  
  18. Here is a sample debugging session.  The program is listed as
  19. part of the debugging session.
  20.  
  21. maestro-tests% /usr/c++/bin/CC -g -o class class.c
  22. CC  class.c:
  23. cc  -L/usr/c++/lib  -o class  -g class.c -Xt -lC
  24. maestro-tests% /net/citron/home/citron/pfieland/gdb-4.6/gdb-4.6/gdb/gdbx class
  25. GDB is free software and you are welcome to distribute copies of it
  26.  under certain conditions; type "show copying" to see the conditions.
  27. There is absolutely no warranty for GDB; type "show warranty" for details.
  28. GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
  29. (gdb) list 1 30
  30. Junk at end of line specification.
  31. (gdb) list 1
  32. 1
  33. 2       class a {
  34. 3       private:
  35. 4           int data;
  36. 5       public:
  37. (gdb)
  38. 6           a() { data =0; }
  39. 7           a(a & val) { data = val.data; }
  40. 8           a(int val) { data = val; }
  41. 9       };
  42. 10
  43. 11      void foo( a temp)
  44. 12      {
  45. 13          a b(temp);
  46. 14          a c=temp;
  47. 15      }
  48. (gdb)
  49. 16
  50. 17      main()
  51. 18      {
  52. 19          a   one(3);
  53. 20
  54. 21          foo(one);
  55. 22          foo(2);
  56. 23      }
  57. 24
  58. (gdb) ptype a
  59. type = class a {
  60.   private:
  61.     int data;
  62.  
  63.   public:
  64.     a ();
  65.     a (struct a &);
  66.     a (int);
  67. }
  68. (gdb) break a::operator()
  69. warning: the class a does not have any method named __cl
  70. Hint: try 'a::operator()<TAB> or 'a::operator()<ESC-?>
  71. (Note leading single quote.)
  72. (gdb)
  73.  
  74. Here is a fix:
  75.  
  76. *** /home/tools/gnu/gdb-4.6/gdb/symtab.h    Mon Jul  6 13:11:13 1992
  77. --- gdb-4.6/gdb/symtab.h    Tue Aug  4 11:31:31 1992
  78. ***************
  79. *** 539,544 ****
  80. --- 540,549 ----
  81.   
  82.   #define VTBL_PREFIX_P(NAME) ((NAME)[3] == CPLUS_MARKER    \
  83.                    && !strncmp ((NAME), "_vt", 3))
  84. + #define CF_OPNAME_PREFIX_P(NAME) ((NAME)[0] == '_' && (NAME)[1] == '_')
  85. + #define CF_VTBL_PREFIX_P(NAME) (!strncmp((NAME), "__vtbl__", CF_VTBL_PREFIX_LEN))
  86. + #define CF_VTBL_PREFIX_LEN  8
  87.   
  88.   /* Functions that work on the objects described above */
  89.   
  90. *** /home/tools/gnu/gdb-4.6/gdb/symtab.c    Tue Jul 14 03:34:30 1992
  91. --- gdb-4.6/gdb/symtab.c    Thu Aug 13 11:19:41 1992
  92. ***************
  93. *** 1649,1655 ****
  94.             else
  95.           {
  96.             char *tmp;
  97.             if (OPNAME_PREFIX_P (copy))
  98.               {
  99.                 tmp = (char *)alloca (strlen (copy+3) + 9);
  100. --- 1683,1690 ----
  101.             else
  102.           {
  103.             char *tmp;
  104. !             /* altered by Peggy Fieland (Margaret_Fieland@vos.stratus.com)
  105. !                to account for cfront conventions */
  106.             if (OPNAME_PREFIX_P (copy))
  107.               {
  108.                 tmp = (char *)alloca (strlen (copy+3) + 9);
  109. ***************
  110. *** 1656,1661 ****
  111. --- 1691,1702 ----
  112.                 strcpy (tmp, "operator ");
  113.                 strcat (tmp, copy+3);
  114.               }
  115. +             else if (CF_OPNAME_PREFIX_P(copy))
  116. +                {
  117. +                   tmp = (char *)alloca (strlen (q) + 10);
  118. +                   strcpy (tmp, "operator ");
  119. +                   strcat (tmp, q);
  120. +                }
  121.             else
  122.               tmp = copy;
  123.             if (tmp[0] == '~')
  124.  
  125.