From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] "$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint.
Date: Thu, 12 Jun 2014 03:49:00 -0000 [thread overview]
Message-ID: <539922D1.9030904@codesourcery.com> (raw)
In-Reply-To: <1402323778-27849-1-git-send-email-palves@redhat.com>
On 06/09/2014 10:22 PM, Pedro Alves wrote:
> And, likewise, "file" with no arguments only started turning
> breakpoints set in the main executable to "<pending>" with the
> remote-symbol-file patch (63644780). The old behavior is now
^^^^^^ remove
I don't see breakpoint set in the main executable becomes "<pending>"
(with and without this patch applied), if the following steps are what
you meant.
(gdb) b main
Breakpoint 1 at 0x80484c1: file
../../../../git/gdb/testsuite/gdb.base/wchar.c, line 29.
(gdb) file
No executable file now.
Discard symbol table from
`/home/yao/Source/gnu/gdb/build-git/x86/gdb/testsuite/gdb.base/wchar'?
(y or n) y
Error in re-setting breakpoint 1: No symbol table is loaded. Use the
"file" command.
No symbol file now.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep n 0x080484c1
> restored, and we break-unload-file.exp test now exercizes both "gdb;
> file PROGRAM" and "gdb PROGRAM".
Hope this table helps the understanding to the flags setting in
different scenarios:
shared library loaded by program OBJF_SHARED
add-symbol-file foo OBJF_SHARED | OBJF_USERLOADED
symbol-file or file foo OBJF_USERLOADED
./gdb foo Neither
> @@ -7729,18 +7729,19 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
> if (objfile == NULL)
> return;
>
> - /* OBJF_USERLOADED are dynamic modules manually managed by the user
> - with add-symbol-file/remove-symbol-file. Similarly to how
> - breakpoints in shared libraries are handled in response to
> - "nosharedlibrary", mark breakpoints in OBJF_USERLOADED modules
> + /* OBJF_SHARED|OBJF_USERLOADED objfiles are dynamic modules manually
> + managed by the user with add-symbol-file/remove-symbol-file.
> + Similarly to how breakpoints in shared libraries are handled in
> + response to "nosharedlibrary", mark breakpoints in such modules
The comments are clear to me...
> shlib_disabled so they end up uninserted on the next global
> location list update. Shared libraries not loaded by the user
> aren't handled here -- they're already handled in
> disable_breakpoints_in_unloaded_shlib, called by solib.c's
> solib_unloaded observer. We skip objfiles that are not
> - OBJF_USERLOADED (nor OBJF_SHARED) as those aren't considered
> - dynamic objects (e.g. the main objfile). */
> - if ((objfile->flags & OBJF_USERLOADED) == 0)
> + OBJF_SHARED as those aren't considered dynamic objects (e.g. the
> + main objfile). */
> + if ((objfile->flags & OBJF_SHARED) == 0
> + || (objfile->flags & OBJF_USERLOADED) == 0)
> return;
... these are clear too, but shouldn't we only check
"(objfile->flags & OBJF_SHARED) == 0" here? which means objfile is a
shared library loaded by program or is added by add-symbol-file can
be processed afterwards.
--
Yao (é½å°§)
next prev parent reply other threads:[~2014-06-12 3:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-09 14:23 Pedro Alves
2014-06-11 19:01 ` Tom Tromey
2014-06-12 3:49 ` Yao Qi [this message]
2014-06-12 12:07 ` Pedro Alves
2014-06-12 13:23 ` Yao Qi
2014-06-12 13:25 ` Pedro Alves
2014-06-16 14:44 ` Pedro Alves
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=539922D1.9030904@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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