Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* GDB aborts on missing command args. Which way to fix?
@ 2008-09-16 17:50 Paul Pluzhnikov
  2008-09-19 21:52 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Pluzhnikov @ 2008-09-16 17:50 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-03 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-16 17:50 GDB aborts on missing command args. Which way to fix? Paul Pluzhnikov
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox