From: Hui Zhu <teawater@gmail.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix "Segmentation fault" when "gdb -v"
Date: Thu, 04 Mar 2010 08:06:00 -0000 [thread overview]
Message-ID: <daef60381003040006p737f1d41hbeabc1fc8fb4352@mail.gmail.com> (raw)
In-Reply-To: <20100304072620.GJ2832@adacore.com>
On Thu, Mar 4, 2010 at 15:26, Joel Brobecker <brobecker@adacore.com> wrote:
>> All of this code use "printf_filtered". But this function must be
>> call after "interp_set".
>> But this part of code call before "interp_set".
>
> I think that this was an unforseen side-effect of a recent change.
> IMO, it's better to get rid of this side-effect (needing the interpreter
> to be set) in printf_filtered.
>
> We should NOT change printf_filtered into printf_unfiltered in this case
> because the same function is used in two different situations:
> - when the user uses -v
> - when the user types "show version"
> In the latter case, the printf_filtered is appropriate.
>
> Now, we need to decide whether pagination should be enabled if
> the interpreter is not set. I think it makes sense to disable pagination
> in this case. If the interpreter is not set yet, we're just printing
> stuff on stdout, we haven't started the interactive session (if any) yet...
>
The way is make it output after interp_set.
Thanks,
Hui
2010-03-04 Hui Zhu <teawater@gmail.com>
* main.c (captured_main): Change version output after
interp_set.
---
main.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
--- a/main.c
+++ b/main.c
@@ -695,19 +695,6 @@ Excess command line arguments ignored. (
gdb_init. */
get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
- /* Do these (and anything which might call wrap_here or *_filtered)
- after initialize_all_files() but before the interpreter has been
- installed. Otherwize the help/version messages will be eaten by
- the interpreter's output handler. */
-
- if (print_version)
- {
- print_gdb_version (gdb_stdout);
- wrap_here ("");
- printf_filtered ("\n");
- exit (0);
- }
-
if (print_help)
{
print_gdb_help (gdb_stdout);
@@ -750,6 +737,19 @@ Excess command line arguments ignored. (
}
}
+ /* Do these (and anything which might call wrap_here or *_filtered)
+ after initialize_all_files() but before the interpreter has been
+ installed. Otherwize the help/version messages will be eaten by
+ the interpreter's output handler. */
+
+ if (print_version)
+ {
+ print_gdb_version (gdb_stdout);
+ wrap_here ("");
+ printf_filtered ("\n");
+ exit (0);
+ }
+
/* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets
GDB retain the old MI1 interpreter startup behavior. Output the
copyright message after the interpreter is installed when it is
next prev parent reply other threads:[~2010-03-04 8:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 6:50 Hui Zhu
2010-03-04 7:26 ` Joel Brobecker
2010-03-04 8:06 ` Hui Zhu [this message]
2010-03-04 13:45 ` Daniel Jacobowitz
2010-03-04 14:02 ` Pedro Alves
2010-03-04 14:59 ` Pedro Alves
2010-03-05 4:59 ` Joel Brobecker
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=daef60381003040006p737f1d41hbeabc1fc8fb4352@mail.gmail.com \
--to=teawater@gmail.com \
--cc=brobecker@adacore.com \
--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