Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: gdb-patches@sourceware.org
Subject: [PATCH] source.c, find_source_lines
Date: Sat, 11 Aug 2007 20:53:00 -0000	[thread overview]
Message-ID: <25041.12.7.175.2.1186865595.squirrel@webmail.sonic.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]

Since 's' is repeatedly assumed, let's assert it rather than
sometimes checking it and sometimes not.


[-- Attachment #2: 57.txt --]
[-- Type: text/plain, Size: 1145 bytes --]

2007-08-11  Michael Snyder  <msnyder@access-company.com>

	* source.c (find_source_lines): Require symtab 's'.

Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.80
diff -p -r1.80 source.c
*** source.c	28 Jun 2007 22:14:06 -0000	1.80
--- source.c	11 Aug 2007 20:46:35 -0000
*************** find_source_lines (struct symtab *s, int
*** 1122,1132 ****
    long mtime = 0;
    int size;
  
    line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
    if (fstat (desc, &st) < 0)
      perror_with_name (s->filename);
  
!   if (s && s->objfile && s->objfile->obfd)
      mtime = bfd_get_mtime (s->objfile->obfd);
    else if (exec_bfd)
      mtime = bfd_get_mtime (exec_bfd);
--- 1122,1133 ----
    long mtime = 0;
    int size;
  
+   gdb_assert (s);
    line_charpos = (int *) xmalloc (lines_allocated * sizeof (int));
    if (fstat (desc, &st) < 0)
      perror_with_name (s->filename);
  
!   if (s->objfile && s->objfile->obfd)
      mtime = bfd_get_mtime (s->objfile->obfd);
    else if (exec_bfd)
      mtime = bfd_get_mtime (exec_bfd);

             reply	other threads:[~2007-08-11 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 20:53 msnyder [this message]
2007-08-13 21:29 ` Jim Blandy
2007-08-13 22:25   ` msnyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25041.12.7.175.2.1186865595.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox