From: "Paul Pluzhnikov" <ppluzhnikov@google.com>
To: gdb-patches@sourceware.org
Subject: GDB aborts on missing command args. Which way to fix?
Date: Tue, 16 Sep 2008 17:50:00 -0000 [thread overview]
Message-ID: <8ac60eac0809161049t6bd917bbk8127317a7d8b42cb@mail.gmail.com> (raw)
Greetings,
There are many instances of calls to buildargv() which aren't
protected by 'if (args != NULL)', and cause gdb to abort.
For example:
(gdb) remote del # missing argument to del.
Program received signal SIGABRT, Aborted.
0x00002aaaab5cac75 in *__GI_raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb-top) bt
#0 0x00002aaaab5cac75 in *__GI_raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00002aaaab5cc620 in *__GI_abort () at ../sysdeps/generic/abort.c:88
#2 0x000000000044f1a5 in internal_vproblem (problem=0x9ad3c0,
file=0x6454db "../../src/gdb/utils.c", line=1002, fmt=<value optimized
out>, ap=<value optimized out>) at ../../src/gdb/utils.c:874
#3 0x000000000044c3c9 in internal_verror (file=0x32a <Address 0x32a
out of bounds>, line=6, fmt=0xffffffffffffffff <Address
0xffffffffffffffff out of bounds>, ap=0x0) at
../../src/gdb/utils.c:889
#4 0x000000000044c461 in internal_error (file=0x32a <Address 0x32a
out of bounds>, line=810, string=0x6 <Address 0x6 out of bounds>) at
../../src/gdb/utils.c:898
#5 0x000000000044cf66 in nomem (size=0) at ../../src/gdb/utils.c:1002
#6 0x0000000000472db1 in remote_delete_command (args=<value optimized
out>, from_tty=0) at ../../src/gdb/remote.c:7231
#7 0x000000000044b323 in execute_command (p=0x9d91ca "", from_tty=0)
at ../../src/gdb/top.c:457
#8 0x00000000004e9617 in command_handler (command=0x9d91c0 "remote
del") at ../../src/gdb/event-top.c:514
#9 0x00000000004ea190 in command_line_handler (rl=<value optimized
out>) at ../../src/gdb/event-top.c:739
#10 0x0000000000597303 in rl_callback_read_char () at
../../src/readline/callback.c:205
#11 0x00000000004e9749 in rl_callback_read_char_wrapper
(client_data=0x32a) at ../../src/gdb/event-top.c:178
#12 0x00000000004e83a3 in process_event () at ../../src/gdb/event-loop.c:341
#13 0x00000000004e8cb8 in gdb_do_one_event (data=<value optimized
out>) at ../../src/gdb/event-loop.c:378
#14 0x00000000004e54db in catch_errors (func=0x4e8b00
<gdb_do_one_event>, func_args=0x0, errstring=0x64d064 "", mask=<value
optimized out>) at ../../src/gdb/exceptions.c:516
#15 0x0000000000490276 in tui_command_loop (data=<value optimized
out>) at ../../src/gdb/tui/tui-interp.c:153
#16 0x0000000000444139 in captured_command_loop (data=0x32a) at
../../src/gdb/main.c:99
#17 0x00000000004e54db in catch_errors (func=0x444130
<captured_command_loop>, func_args=0x0, errstring=0x64d064 "",
mask=<value optimized out>) at ../../src/gdb/exceptions.c:516
#18 0x00000000004448de in captured_main (data=<value optimized out>)
at ../../src/gdb/main.c:831
#19 0x00000000004e54db in catch_errors (func=0x444170 <captured_main>,
func_args=0x7fffffffe620, errstring=0x64d064 "", mask=<value optimized
out>) at ../../src/gdb/exceptions.c:516
#20 0x0000000000444124 in gdb_main (args=0x32a) at ../../src/gdb/main.c:840
#21 0x00000000004440f6 in main (argc=<value optimized out>,
argv=0x32a) at ../../src/gdb/gdb.c:33
I can fix this by adding the 'if (args != NULL)' checks everywhere,
or by switching to 'buildargv_not_null(args, "appropriate missing
argument error")'
Which way is preferred? (I prefer the second way).
Thanks,
--
Paul Pluzhnikov
next reply other threads:[~2008-09-16 17:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-16 17:50 Paul Pluzhnikov [this message]
2008-09-19 21:52 ` Tom Tromey
2008-09-19 22:02 ` Daniel Jacobowitz
2008-09-26 23:22 ` [patch] " Paul Pluzhnikov
2008-10-03 7:04 ` Joel Brobecker
2008-10-03 16:39 ` Paul Pluzhnikov
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=8ac60eac0809161049t6bd917bbk8127317a7d8b42cb@mail.gmail.com \
--to=ppluzhnikov@google.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