Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Segfault in user command
@ 2009-07-21  2:09 Marc Khouzam
  2009-07-21  5:43 ` Paul Pluzhnikov
  2009-07-21  9:20 ` Pedro Alves
  0 siblings, 2 replies; 4+ messages in thread
From: Marc Khouzam @ 2009-07-21  2:09 UTC (permalink / raw)
  To: gdb

Hi,

I was trying to use 'interpreter-exec mi' inside a user-defined command,
and GDB segfaulted (session below).  It is today's version of GDB.
I had seen this in passing many moons ago, but today I told myself I 
really should report it.  Should I open a bugzilla about it?

Thanks

Marc


GNU gdb (GDB) 6.8.50.20090720-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) define minext
Type commands for definition of "minext".
End with a line saying just "end".
>interpreter-exec mi -exec-next
>end
(gdb) start
Temporary breakpoint 1 at 0x80484ce: file c.cc, line 9.
Starting program: /home/marc/testing/a.out 

Temporary breakpoint 1, main () at c.cc:9
9       int a = 1;
(gdb) minext
Segmentation fault


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

* Re: Segfault in user command
  2009-07-21  2:09 Segfault in user command Marc Khouzam
@ 2009-07-21  5:43 ` Paul Pluzhnikov
  2009-07-21  9:20 ` Pedro Alves
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Pluzhnikov @ 2009-07-21  5:43 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: gdb

On Mon, Jul 20, 2009 at 7:08 PM, Marc Khouzam<marc.khouzam@ericsson.com> wrote:

> I was trying to use 'interpreter-exec mi' inside a user-defined command,
> and GDB segfaulted (session below).  It is today's version of GDB.

The problem is that in cli/cli-script.c, execute_user_command(),
instream is set to NULL:

312	  /* Set the instream to 0, indicating execution of a
313	     user-defined function.  */
314	  make_cleanup (do_restore_instream_cleanup, instream);
315	  instream = (FILE *) 0;

and later used for fileno():

#0  0x00007ffff6ea19f0 in fileno_unlocked () from /lib/libc.so.6
#1  0x000000000051d2ff in gdb_setup_readline () at
../../src/gdb/event-top.c:1086
#2  0x00000000004aaa09 in mi_interpreter_resume (data=0x0) at
../../src/gdb/mi/mi-interp.c:107
#3  0x00000000005180d7 in interp_set (interp=0xa7a850, top_level=0) at
../../src/gdb/interps.c:197
#4  0x000000000051834e in interpreter_exec_cmd (args=<value optimized
out>, from_tty=<value optimized out>) at ../../src/gdb/interps.c:398
#5  0x0000000000459984 in execute_command (p=0xb295fd "t", from_tty=0)
at ../../src/gdb/top.c:442
#6  0x00000000004a2c04 in execute_control_command (cmd=0xb23c40) at
../../src/gdb/cli/cli-script.c:400
#7  0x00000000004a31ad in execute_user_command (c=0xb3fd60, args=0x0)
at ../../src/gdb/cli/cli-script.c:324

> I had seen this in passing many moons ago, but today I told myself I
> really should report it.  Should I open a bugzilla about it?

Probably.
I think every crash in GDB deserves a bugzilla entry.

Cheers,
-- 
Paul Pluzhnikov


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

* Re: Segfault in user command
  2009-07-21  2:09 Segfault in user command Marc Khouzam
  2009-07-21  5:43 ` Paul Pluzhnikov
@ 2009-07-21  9:20 ` Pedro Alves
  2009-07-22 17:11   ` Marc Khouzam
  1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2009-07-21  9:20 UTC (permalink / raw)
  To: gdb; +Cc: Marc Khouzam

On Tuesday 21 July 2009 03:08:53, Marc Khouzam wrote:
> Hi,
> 
> I was trying to use 'interpreter-exec mi' inside a user-defined command,
> and GDB segfaulted (session below).  It is today's version of GDB.
> I had seen this in passing many moons ago, but today I told myself I 
> really should report it.  Should I open a bugzilla about it?

If it isn't reported yet, sure.  It sounds suspiciously similar to
PR10347 though.

 http://sourceware.org/bugzilla/show_bug.cgi?id=10347

A backtrace on both test cases should confirm it.  (It's always nice
to paste gdb backtraces on crash PRs).

-- 
Pedro Alves


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

* RE: Segfault in user command
  2009-07-21  9:20 ` Pedro Alves
@ 2009-07-22 17:11   ` Marc Khouzam
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Khouzam @ 2009-07-22 17:11 UTC (permalink / raw)
  To: Pedro Alves, gdb, Paul Pluzhnikov

> It sounds suspiciously similar to PR10347 though.

Thanks guys.
I've confirmed that it is the same problem by comparing
the backtraces.
I have update that bug with the analysis from Paul.

Marc


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

end of thread, other threads:[~2009-07-22 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-21  2:09 Segfault in user command Marc Khouzam
2009-07-21  5:43 ` Paul Pluzhnikov
2009-07-21  9:20 ` Pedro Alves
2009-07-22 17:11   ` Marc Khouzam

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