public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17394] New: The user cannot put a break-point at a global function only for a selected ASM file.
@ 2014-09-15 13:07 mihail.nistor at freescale dot com
  2014-09-15 13:29 ` [Bug gdb/17394] " mihail.nistor at freescale dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mihail.nistor at freescale dot com @ 2014-09-15 13:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17394

            Bug ID: 17394
           Summary: The user cannot put a break-point at a global function
                    only for a selected ASM file.
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: mihail.nistor at freescale dot com

Created attachment 7787
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7787&action=edit
version information and test case to reproduce this problem.

In order to reproduce this problem please follow steps below:
1) Compile the application by using the following command: gcc -O0 -g main.c
file.s 
2) Start a gdb console in that directory, type the gdb command.
3) In the gdb console type the file a.out command.
4) Try to set a breakpoint at func only for the file.s file, the command is: b
file.s:func

Please observe that the break-point cannot be computed, so the gdb report the
following message: 
Function "func" not defined in "file.s".
Make break-point pending on future shared library load? (y or [n])

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17394] The user cannot put a break-point at a global function only for a selected ASM file.
  2014-09-15 13:07 [Bug gdb/17394] New: The user cannot put a break-point at a global function only for a selected ASM file mihail.nistor at freescale dot com
@ 2014-09-15 13:29 ` mihail.nistor at freescale dot com
  2014-09-15 14:33 ` mihail.nistor at freescale dot com
  2014-12-20 16:33 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mihail.nistor at freescale dot com @ 2014-09-15 13:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17394

Mihail-Marian Nistor <mihail.nistor at freescale dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mihail.nistor at freescale dot com

--- Comment #1 from Mihail-Marian Nistor <mihail.nistor at freescale dot com> ---
I will send a patch file for this problem ASAP.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17394] The user cannot put a break-point at a global function only for a selected ASM file.
  2014-09-15 13:07 [Bug gdb/17394] New: The user cannot put a break-point at a global function only for a selected ASM file mihail.nistor at freescale dot com
  2014-09-15 13:29 ` [Bug gdb/17394] " mihail.nistor at freescale dot com
@ 2014-09-15 14:33 ` mihail.nistor at freescale dot com
  2014-12-20 16:33 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mihail.nistor at freescale dot com @ 2014-09-15 14:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17394

--- Comment #2 from Mihail-Marian Nistor <mihail.nistor at freescale dot com> ---
Hi all,

I have sent a patch file to gdb-patches@sourceware.org mail-list. 

I'm looking forward to receiving the feedback. 

Best regards,
Mihai

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17394] The user cannot put a break-point at a global function only for a selected ASM file.
  2014-09-15 13:07 [Bug gdb/17394] New: The user cannot put a break-point at a global function only for a selected ASM file mihail.nistor at freescale dot com
  2014-09-15 13:29 ` [Bug gdb/17394] " mihail.nistor at freescale dot com
  2014-09-15 14:33 ` mihail.nistor at freescale dot com
@ 2014-12-20 16:33 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-12-20 16:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17394

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  87186c6a5ccf857d7f4e55478dda3aa06387c3c4 (commit)
      from  bd040da1dbb7e6640440f306ddf993af98441851 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=87186c6a5ccf857d7f4e55478dda3aa06387c3c4

commit 87186c6a5ccf857d7f4e55478dda3aa06387c3c4
Author: Mihail-Marian Nistor <mihail.nistor@freescale.com>
Date:   Sat Dec 20 11:04:44 2014 -0500

    gdb/17394: cannot put breakpoint only in selected ASM file.

    This patch fixes a problem when trying to insert a breakpoint on
    a specific symbol defined in a specific file, eg:

        break foo.c:func

    This currently works for files in C/C++/Ada, etc, but doesn't always
    work for Asm files. Analysis of the problem showed that this related
    to a limitation in gas, which does not generate debug info for functions/
    symbols.  Thus, we have a symtab for the file ("info sources" shows
    the file), but it contains no symbols.

    When find_linespec_symbols is called in linespec_parse_basic, it calls
    find_function_symbols, which uses add_matching_symbols_to_info to
    collect all matching symbols.

    That function does [pardon any mangled formatting]:

      for (ix = 0; VEC_iterate (symtab_ptr, info->file_symtabs, ix, elt); ++ix)
        {
          if (elt == NULL)
            {
              iterate_over_all_matching_symtabs (info->state, name, VAR_DOMAIN,
                                                 collect_symbols, info,
                                                 pspace, 1);
              search_minsyms_for_name (info, name, pspace);
            }
          else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt))
            {
              /* Program spaces that are executing startup should have
                 been filtered out earlier.  */
              gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup);
              set_current_program_space (SYMTAB_PSPACE (elt));
              iterate_over_file_blocks (elt, name, VAR_DOMAIN,
                                        collect_symbols, info);
            }
        }

    This iterates over the symtabs. In the failing use case, ELT is
    non-NULL (points to the symtab for the .s file), so it calls
    iterate_over_file_blocks. Herein is where the problem exists: it is
    assumed that if NAME exists, it must exist in the given symtab -- a
    reasonable assumption for "normal" (non-asm) cases. It never searches
    minimal symbols (or in the global default symtab).

    This patch fixes the problem by doing so. It is important to note that
    iterating over minsyms is fairly expensive, so this patch only adds
    that extra search if the language is language_asm and
    iterate_over_file_blocks returns no symbols.

    gdb/ChangeLog:
    2014-12-20  Keith Seitz  <keiths@redhat.com>
                Mihail-Marian Nistor  <mihail.nistor@freescale.com>

            PR gdb/17394
            * linespec.c (struct collect_minsyms): Add new member `symtab'.
            (add_minsym): Handle cases where info.symtab is non-NULL.
            (search_minsyms_for_name): Add new parameter `symtab'.
            Handle limiting searches to a specific symtab.
            (add_matching_symtabs_to_info): Search through minimal symbols
            for language_asm files for which no new symbols are found.

    gdb/testsuite/ChangeLog:
    2014-12-20  Mihail-Marian Nistor  <mihail.nistor@freescale.com>

            PR gdb/17394
            * gdb.linespec/break-asm-file.c: New file.
            * gdb.linespec/break-asm-file.exp: New file.
            * gdb.linespec/break-asm-file0.s: New file.
            * gdb.linespec/break-asm-file1.s: New file.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                 |   11 +
 gdb/linespec.c                                |   97 ++++++++---
 gdb/testsuite/ChangeLog                       |    8 +
 gdb/testsuite/gdb.linespec/break-asm-file.c   |   35 ++++
 gdb/testsuite/gdb.linespec/break-asm-file.exp |   55 ++++++
 gdb/testsuite/gdb.linespec/break-asm-file0.s  |  218 ++++++++++++++++++++++
 gdb/testsuite/gdb.linespec/break-asm-file1.s  |  244 +++++++++++++++++++++++++
 7 files changed, 644 insertions(+), 24 deletions(-)
 create mode 100644 gdb/testsuite/gdb.linespec/break-asm-file.c
 create mode 100644 gdb/testsuite/gdb.linespec/break-asm-file.exp
 create mode 100644 gdb/testsuite/gdb.linespec/break-asm-file0.s
 create mode 100644 gdb/testsuite/gdb.linespec/break-asm-file1.s

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-20 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 13:07 [Bug gdb/17394] New: The user cannot put a break-point at a global function only for a selected ASM file mihail.nistor at freescale dot com
2014-09-15 13:29 ` [Bug gdb/17394] " mihail.nistor at freescale dot com
2014-09-15 14:33 ` mihail.nistor at freescale dot com
2014-12-20 16:33 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).