From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] PID cmdline argument should be whole from digits
Date: Sat, 13 Feb 2010 15:20:00 -0000 [thread overview]
Message-ID: <20100213152044.GA6115@host0.dyn.jankratochvil.net> (raw)
Hi,
# gdb ./1 1.core
Attaching to program: .../1, process 1
warning: process 1 is a cloned process
Cannot access memory at address 0x3d001006
that is scary because on a test box I ran as root. Normally it just prints
(and loads it as a core file then):
Attaching to program: .../1, process 1
ptrace: Operation not permitted.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
strspn is already freely in use by libiberty/cplus-dem.c.
I will check it in as [obv] in several days if there are no objections.
Thanks,
Jan
2010-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* main.c (captured_main) <pid_or_core_arg>: Check the whole
PID_OR_CORE_ARG consists of digit characters.
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -827,10 +827,11 @@ Can't attach to process and specify a core file at the same time."));
else if (pid_or_core_arg)
{
/* The user specified 'gdb program pid' or gdb program core'.
- If pid_or_core_arg's first character is a digit, try attach
- first and then corefile. Otherwise try just corefile. */
+ If pid_or_core_arg's is a number, try attach first and then corefile.
+ Otherwise try just corefile. */
- if (isdigit (pid_or_core_arg[0]))
+ if (pid_or_core_arg[0] != 0
+ && strspn (pid_or_core_arg, "0123456789") == strlen (pid_or_core_arg))
{
if (catch_command_errors (attach_command, pid_or_core_arg,
!batch, RETURN_MASK_ALL) == 0)
next reply other threads:[~2010-02-13 15:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-13 15:20 Jan Kratochvil [this message]
2010-02-13 17:47 ` Eli Zaretskii
2010-02-13 21:03 ` Jan Kratochvil
2010-02-14 14:37 ` [patch] PID cmdline argument should be whole from digits [+testcase] Jan Kratochvil
2010-02-14 14:54 ` Pedro Alves
2010-02-14 18:56 ` Jan Kratochvil
2010-02-15 14:57 ` Pedro Alves
2010-02-15 15:52 ` Jan Kratochvil
2010-02-15 16:03 ` Mark Kettenis
2010-02-15 17:38 ` Jan Kratochvil
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=20100213152044.GA6115@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.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