home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gdb / bug / 882 < prev    next >
Encoding:
Text File  |  1992-07-23  |  3.7 KB  |  136 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!cygnus.com!grossman
  3. From: grossman@cygnus.com (Stu Grossman)
  4. Subject: patch for N_SO crash
  5. Message-ID: <9207201958.AA20928@cygnus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Mon, 20 Jul 1992 19:58:09 GMT
  10. Approved: bug-gdb@prep.ai.mit.edu
  11. Lines: 123
  12.  
  13. The following patch fixes a crash that occurs when reading symbol tables that
  14. have extra N_SO records.  This is mainly a problem on Suns when using certain
  15. C or C++ compilers.
  16.                 Stu
  17.  
  18. ===================================================================
  19. diff -c partial-stab.h-orig partial-stab.h
  20. *** partial-stab.h-orig    1992/07/04 13:58:43
  21. --- partial-stab.h    1992/07/16 20:40:36
  22. ***************
  23. *** 198,208 ****
  24.   
  25.       case N_SO: {
  26.         unsigned long valu = CUR_SYMBOL_VALUE;
  27. !       static int last_so_symnum = -10;
  28. !       static int dir_so_symnum = -10;
  29. !       int tmp;
  30.         char *p;
  31.         
  32.         /* End the current partial symtab and start a new one */
  33.   
  34.         SET_NAMESTRING();
  35. --- 198,226 ----
  36.   
  37.       case N_SO: {
  38.         unsigned long valu = CUR_SYMBOL_VALUE;
  39. !       static int prev_so_symnum = -10;
  40. !       static int first_so_symnum;
  41.         char *p;
  42.         
  43. +       past_first_source_file = 1;
  44. +       if (prev_so_symnum != symnum - 1)
  45. +         {            /* Here if prev stab wasn't N_SO */
  46. +           first_so_symnum = symnum;
  47. +           if (pst)
  48. +         {
  49. +           END_PSYMTAB (pst, psymtab_include_list, includes_used,
  50. +                    symnum * symbol_size, valu,
  51. +                    dependency_list, dependencies_used);
  52. +           pst = (struct partial_symtab *) 0;
  53. +           includes_used = 0;
  54. +           dependencies_used = 0;
  55. +         }
  56. +         }
  57. +       prev_so_symnum = symnum;
  58.         /* End the current partial symtab and start a new one */
  59.   
  60.         SET_NAMESTRING();
  61. ***************
  62. *** 209,224 ****
  63.   
  64.         valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
  65.   
  66. -       if (pst)
  67. -         {
  68. -           END_PSYMTAB (pst, psymtab_include_list, includes_used,
  69. -                symnum * symbol_size, valu,
  70. -                dependency_list, dependencies_used);
  71. -           pst = (struct partial_symtab *) 0;
  72. -           includes_used = 0;
  73. -           dependencies_used = 0;
  74. -         }
  75.         /* Some compilers (including gcc) emit a pair of initial N_SOs.
  76.            The first one is a directory name; the second the file name.
  77.            If pst exists, is empty, and has a filename ending in '/',
  78. --- 227,232 ----
  79. ***************
  80. *** 226,255 ****
  81.   
  82.         p = strrchr (namestring, '/');
  83.         if (p && *(p+1) == '\000')
  84. !         {
  85. !           dir_so_symnum = symnum;
  86. !           continue;        /* Simply ignore directory name SOs */
  87. !         }
  88.   
  89.         /* Some other compilers (C++ ones in particular) emit useless
  90. !          SOs for non-existant .c files. */
  91. !       if (last_so_symnum == symnum - 1)
  92. !         continue;        /* Ignore repeated SOs */
  93. !       last_so_symnum = symnum;
  94. !       past_first_source_file = 1;
  95.   
  96. !       if (dir_so_symnum == symnum - 1) /* Was prev. SO a directory? */
  97. !         tmp = dir_so_symnum;
  98. !       else
  99. !         tmp = symnum;
  100. !       pst = START_PSYMTAB (objfile, section_offsets,
  101. !                    namestring, valu,
  102. !                    tmp * symbol_size,
  103. !                    objfile -> global_psymbols.next,
  104. !                    objfile -> static_psymbols.next);
  105. !       dir_so_symnum = -10;
  106.         continue;
  107.       }
  108.   
  109. --- 234,251 ----
  110.   
  111.         p = strrchr (namestring, '/');
  112.         if (p && *(p+1) == '\000')
  113. !         continue;        /* Simply ignore directory name SOs */
  114.   
  115.         /* Some other compilers (C++ ones in particular) emit useless
  116. !          SOs for non-existant .c files.  We ignore all subsequent SOs that
  117. !          immediately follow the first.  */
  118.   
  119. !       if (!pst)
  120. !         pst = START_PSYMTAB (objfile, section_offsets,
  121. !                  namestring, valu,
  122. !                  first_so_symnum * symbol_size,
  123. !                  objfile -> global_psymbols.next,
  124. !                  objfile -> static_psymbols.next);
  125.         continue;
  126.       }
  127.   
  128.  
  129.