From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [RFC] Don't create inferior in tfile target.
Date: Fri, 24 May 2013 08:07:00 -0000 [thread overview]
Message-ID: <519F1FD9.8060307@codesourcery.com> (raw)
In-Reply-To: <5193AAD0.1030808@redhat.com>
On 05/15/2013 11:33 PM, Pedro Alves wrote:
> I have a very vague recollection that it was I who suggested this
> in internal reviews at the time, but GDB was a bit different then,
> and I don't recall exactly why. It's possible you might find that
> in CS's archives.
I went through the CS's archives (in a range of 3 years), but didn't
find anything related to it.
> I was going to say this would break "detach" with tfile
> (detach_command checks for null_ptid). Except "detach" with tfile
> doesn't work already -- with target core,
Yes, this patch changes the behaviour of "detach" on tfile, without this
patch, there is no output after command 'detach'.
(gdb) detach
However, with this patch, GDB prints something,
(gdb) detach
The program is not being run.
> "detach" unloads the core, and I assumed tfile behaved the same.
> I think it'd be reasonable if it did.
'detach' uploads the core, but I don't think 'detach' should behave the
same in tfile target. The GDB manual says about 'detach' command:
"When you have finished debugging the attached process, you can use the
detach command to release it from gdb control. Detaching the process
continues its execution. After the detach command, that process and gdb
become completely independent once more, and you are ready to attach
another process or start one with run."
User can use 'detach' command to release the process from gdb control.
Command 'detach' applies to core file, because the pid of the process
which core file is dumped is stored in core file, so GDB can 'emulate'
the pid of the core file. However, the tfile and ctf doesn't save the
pid in it (unnecessary to do so on the other hand), so command 'detach'
doesn't apply to tfile. The output "The program is not being run." of
command 'detach' on tfile is reasonable to me.
>
> You didn't mention it explicitly, so I'll ask.
> There are probably more commands that treat null_ptid magically.
> Could you audit kill, detach, continue, step, etc.
> to see if they'll do something reasonable? Or rather,
The commands 'step', 'continue' behave the same, while command 'kill'
behaves differently.
Without this patch,
(gdb) kill
Kill the program being debugged? (y or n) y
You can't do that without a process to debug.
With this patch,
(gdb) kill
The program is not being run.
According to the GDB manual, 'kill' command is "Kill the child process
in which your program is running under gdb", we don't have a child
process at all on tfile, IMO, the later is more reasonable.
The output of 'info threads' on tfile changes also,
without this patch:
(gdb) info threads
Id Target Id Frame
* 1 process 1 No registers.
with this patch:
(gdb) info threads
No threads.
I feel the latter is more reasonable.
Without this patch command 'thread name' print nothing, but with this
patch, command 'thread name' prints "No thread selected".
> could you audit/grep the tree for null_ptid uses? E.g.,
> I see that dcache.c uses null_ptid as magic number, but
> probably that doesn't matter for tfile. There don't seem
> to be that many checks for null_ptid, and many are in run
> control code, which obviously doesn't apply, so an audit
> seems doable.
I examined the null_ptid usages, looks the usages in target.c are not
affected by this change. I also tried commands 'info frame' and
'maintenance print registers', the output is the same.
In short, this patch changes the output of some commands, but the
changes are reasonable to me. WDYT?
--
Yao (é½å°§)
next prev parent reply other threads:[~2013-05-24 8:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-04 1:31 Yao Qi
2013-05-15 15:33 ` Pedro Alves
2013-05-16 0:59 ` Stan Shebs
2013-05-24 8:07 ` Yao Qi [this message]
2013-05-24 10:43 ` Pedro Alves
2013-05-24 12:28 ` Yao Qi
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=519F1FD9.8060307@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