+ ++sal->nelts;
+}
+
+/* Helper to expand_line_sal below. Search in the symtabs for any
+ linetable entry that exactly matches FULLNAME and LINENO and append
+ them to RET. If FULLNAME is NULL or if a symtab has no full name,
+ use FILENAME and LINENO instead. If there is at least one match,
+ return 1; otherwise, return 0, and return the best choice in BEST_ITEM
+ and BEST_SYMTAB. */
+
+static int
+append_exact_match_to_sals (char *filename, char *fullname, int lineno,
+ struct symtabs_and_lines *ret,
+ struct linetable_entry **best_item,
+ struct symtab **best_symtab)
+{
+ struct program_space *pspace;
+ struct objfile *objfile;
+ struct symtab *symtab;
+ int exact = 0;
+ int j;
+ *best_item = 0;
+ *best_symtab = 0;
+
+ ALL_PSPACES (pspace)
+ ALL_PSPACE_SYMTABS (pspace, objfile, symtab)
+ {
+ if (FILENAME_CMP (filename, symtab->filename) == 0)
+ {
+ struct linetable *l;
+ int len;
+ if (fullname != NULL
+ && symtab_to_fullname (symtab) != NULL
+ && FILENAME_CMP (fullname, symtab->fullname) != 0)
+ continue;
+ l = LINETABLE (symtab);
+ if (!l)
+ continue;
+ len = l->nitems;
+
+ for (j = 0; j < len; j++)
+ {
+ struct linetable_entry *item = &(l->item[j]);
+
+ if (item->line == lineno)
+ {
+ exact = 1;
+ append_expanded_sal (ret, objfile->pspace,
+ symtab, lineno, item->pc);
+ }
+ else if (!exact && item->line > lineno
+ && (*best_item == NULL
+ || item->line < (*best_item)->line))
+ {
+ *best_item = item;
+ *best_symtab = symtab;
+ }
+ }
+ }
+ }
+ return exact;