gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 24 Dec 2012 19:42:16 +0000 (19:42 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 24 Dec 2012 19:42:16 +0000 (19:42 +0000)
Code cleanup.
* dwarf2read.c (fixup_go_packaging): Do not check symtab->FILENAME for
NULL.
* linespec.c (add_sal_to_sals): Likewise.
* psympriv.h (allocate_psymtab): Add ATTRIBUTE_NONNULL.
* stack.c (print_frame): Do not check symtab->FILENAME for NULL.
* symfile.h (allocate_symtab): Add ATTRIBUTE_NONNULL.
* symtab.h (struct symtab): Add comment it is never NULL for filename.
* tracepoint.c (set_traceframe_context): Do not check symtab->FILENAME
for NULL.
* tui/tui-source.c (tui_set_source_content): Likewise.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/linespec.c
gdb/psympriv.h
gdb/stack.c
gdb/symfile.h
gdb/symtab.h
gdb/tracepoint.c
gdb/tui/tui-source.c

index e4248dd..eb9cfdc 100644 (file)
@@ -1,5 +1,19 @@
 2012-12-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+       Code cleanup.
+       * dwarf2read.c (fixup_go_packaging): Do not check symtab->FILENAME for
+       NULL.
+       * linespec.c (add_sal_to_sals): Likewise.
+       * psympriv.h (allocate_psymtab): Add ATTRIBUTE_NONNULL.
+       * stack.c (print_frame): Do not check symtab->FILENAME for NULL.
+       * symfile.h (allocate_symtab): Add ATTRIBUTE_NONNULL.
+       * symtab.h (struct symtab): Add comment it is never NULL for filename.
+       * tracepoint.c (set_traceframe_context): Do not check symtab->FILENAME
+       for NULL.
+       * tui/tui-source.c (tui_set_source_content): Likewise.
+
+2012-12-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
        * breakpoint.c (breakpoint_re_set): Remove the skip_re_set call.
        * infrun.c (handle_inferior_event): Rename the called function to
        function_name_is_marked_for_skip, pass it TMP_SAL.
index beb2ea8..3f86985 100644 (file)
@@ -6733,7 +6733,6 @@ fixup_go_packaging (struct dwarf2_cu *cu)
                    complaint (&symfile_complaints,
                               _("Symtab %s has objects from two different Go packages: %s and %s"),
                               (SYMBOL_SYMTAB (sym)
-                               && SYMBOL_SYMTAB (sym)->filename
                                ? SYMBOL_SYMTAB (sym)->filename
                                : cu->objfile->name),
                               this_package_name, package_name);
index e9918b1..c22ffe7 100644 (file)
@@ -852,7 +852,7 @@ add_sal_to_sals (struct linespec_state *self,
 
       self->canonical_names = xrealloc (self->canonical_names,
                                        sals->nelts * sizeof (char *));
-      if (!literal_canonical && sal->symtab && sal->symtab->filename)
+      if (!literal_canonical && sal->symtab)
        {
          char *filename = sal->symtab->filename;
 
index ec9aa4a..21471c7 100644 (file)
@@ -226,7 +226,8 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *,
                                                    struct partial_symbol **);
 
 extern struct partial_symtab *allocate_psymtab (const char *,
-                                               struct objfile *);
+                                               struct objfile *)
+  ATTRIBUTE_NONNULL (1);
 
 extern void discard_psymtab (struct objfile *, struct partial_symtab *);
 
index b01c8f0..e246a68 100644 (file)
@@ -1178,7 +1178,7 @@ print_frame (struct frame_info *frame, int print_level,
       QUIT;
     }
   ui_out_text (uiout, ")");
-  if (sal.symtab && sal.symtab->filename)
+  if (sal.symtab)
     {
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
@@ -1199,7 +1199,7 @@ print_frame (struct frame_info *frame, int print_level,
       annotate_frame_source_end ();
     }
 
-  if (pc_p && (!funname || (!sal.symtab || !sal.symtab->filename)))
+  if (pc_p && (funname == NULL || sal.symtab == NULL))
     {
 #ifdef PC_SOLIB
       char *lib = PC_SOLIB (get_frame_pc (frame));
index 223f874..ff7fc81 100644 (file)
@@ -454,7 +454,8 @@ extern struct symfile_segment_data *default_symfile_segments (bfd *abfd);
 extern bfd_byte *default_symfile_relocate (struct objfile *objfile,
                                            asection *sectp, bfd_byte *buf);
 
-extern struct symtab *allocate_symtab (const char *, struct objfile *);
+extern struct symtab *allocate_symtab (const char *, struct objfile *)
+  ATTRIBUTE_NONNULL (1);
 
 extern void add_symtab_fns (const struct sym_fns *);
 
index d0b668f..477ada9 100644 (file)
@@ -815,7 +815,7 @@ struct symtab
      all the symtabs in a given compilation unit.  */
   struct macro_table *macro_table;
 
-  /* Name of this source file.  */
+  /* Name of this source file.  This pointer is never NULL.  */
 
   char *filename;
 
index f61ede7..848179a 100644 (file)
@@ -312,8 +312,7 @@ set_traceframe_context (struct frame_info *trace_frame)
 
   /* Save file name as "$trace_file", a debugger variable visible to
      users.  */
-  if (traceframe_sal.symtab == NULL
-      || traceframe_sal.symtab->filename == NULL)
+  if (traceframe_sal.symtab == NULL)
     clear_internalvar (lookup_internalvar ("trace_file"));
   else
     set_internalvar_string (lookup_internalvar ("trace_file"),
index 030653c..a0daac7 100644 (file)
@@ -46,7 +46,7 @@ tui_set_source_content (struct symtab *s,
 {
   enum tui_status ret = TUI_FAILURE;
 
-  if (s != (struct symtab *) NULL && s->filename != (char *) NULL)
+  if (s != (struct symtab *) NULL)
     {
       FILE *stream;
       int i, desc, c, line_width, nlines;