public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/26036] New: GDB core dump TUI + rl
@ 2020-05-25  6:02 phi.debian at gmail dot com
  2020-05-27  5:58 ` [Bug tui/26036] " phi.debian at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-05-25  6:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

            Bug ID: 26036
           Summary: GDB core dump TUI + rl
           Product: gdb
           Version: 9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tui
          Assignee: unassigned at sourceware dot org
          Reporter: phi.debian at gmail dot com
  Target Milestone: ---

Hi Guru's

I bumped into this the other day.

GDB coming from ubuntu 20.04
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1

Or the one I built on ubuntu 20.04 with latest launchpad  (that one have nice
colorify btw)

I got no .gdbinit  and no .inputrc (to remove this from the equation)

Yet starting gdb on my helloworld program in -tui if I strike ^X^A from the
prompt it cores dump :(

PW$ gdb -tui ./c
[Strike ^X^A here]
Aborted (core dumped)

PW$ 

A brute core inspection (on my own build, so addr may vary) give this

Dunno if this helps, the BT shows
(gdb) bt
#0  0x00007f0c717c418b in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f0c717a3859 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x0000564770c3c2bc in handle_sigsegv (sig=11)
    at /ldev/gdb-9.1/gdb/event-top.c:884
#3  <signal handler called>
#4  0x00007f0c718044a5 in fwrite () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000564770fcb990 in _rl_output_some_chars (
    string=0x564772173270 "(gdb) ", count=6)
    at /ldev/gdb-9.1/readline/readline/terminal.c:647
#6  0x0000564770fc3d75 in update_line (old=0x56477215d320 "",
    new=0x564772173270 "(gdb) ", current_line=0, omax=79, nmax=79,
    inv_botlin=0) at /ldev/gdb-9.1/readline/readline/display.c:2088

....

The offentding fwrite

   643   /* Write COUNT characters from STRING to the output stream. */
   644   void                                                          
   645   _rl_output_some_chars (const char *string, int count)        
B+ 646   {                                                            
  >647     fwrite (string, 1, count, _rl_out_stream);                  
   648   }                                                            
   649       

The _rl_output_some_chars() args.

(gdb) p string
$5 = 0x5555561c57d0 "(gdb) "
(gdb) p count
$6 = 6
(gdb) p _rl_out_stream
$7 = (FILE *) 0x0  <====== is that expected ?=====

I am not a GDB developer so I don't dare chasing why we got thsi NULL ptr and
where to patch.

Cheers,
Phi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
@ 2020-05-27  5:58 ` phi.debian at gmail dot com
  2020-05-27  6:20 ` phi.debian at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-05-27  5:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

Phi <phi.debian at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|9.1                         |9.2

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
  2020-05-27  5:58 ` [Bug tui/26036] " phi.debian at gmail dot com
@ 2020-05-27  6:20 ` phi.debian at gmail dot com
  2020-05-27  7:00 ` phi.debian at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-05-27  6:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

--- Comment #1 from Phi <phi.debian at gmail dot com> ---
Verified on GDB-9.2 
Build on Ubuntu 20.04

I guess the root cause is the same (rl not initialised) but now it materialize
elsewhere in 9.2.

           -----------------------------------------v
#0  __GI__IO_fputs (str=0x555556187410 "(gdb) ", fp=0x0) at iofputs.c:32
#1  0x0000555555bc4199 in readline_internal_setup ()
    at ../../../readline/readline/readline.c:436
#2  0x0000555555be44a7 in _rl_callback_newline ()
    at ../../../readline/readline/callback.c:100

 ../../../readline/readline/readline.c:436
...
       if (rl_prompt && rl_already_prompted == 0)
        {
          nprompt = _rl_strip_prompt (rl_prompt);
          fprintf (_rl_out_stream, "%s", nprompt);
          fflush (_rl_out_stream);
          xfree (nprompt);
        } 
...
(*)
(gdb) p _rl_out_stream
$2 = (FILE *) 0


I guess it should be fixed at 9.2 and backported at 9.1...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
  2020-05-27  5:58 ` [Bug tui/26036] " phi.debian at gmail dot com
  2020-05-27  6:20 ` phi.debian at gmail dot com
@ 2020-05-27  7:00 ` phi.debian at gmail dot com
  2020-06-06 18:18 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-05-27  7:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

--- Comment #2 from Phi <phi.debian at gmail dot com> ---
Well in case someone takes ownership, here is my finding.

I am NOT c++ aware, and I don't know GDB software organisation at all, so I may
be completly out of bounds.

To me TUI is the culprit (not RL that got a NULL *FILE).

In the function 
/ldev/gdb-9.[12]/gdb/tui/tui-io.c
tui_setup_io (int mode)         
{
}

When mode==1 (curses) there is a killing sequence.

  if (mode)
    {
      /* Redirect readline to TUI.  */
...
      tui_old_rl_outstream = rl_outstream;
...
      rl_outstream = tui_rl_outstream;
...

    }

When run with -tui  we enter here with RL not initialised, then
rl_outstream==0, later on on GDB first prompt, we strike ^X^A, tui restore the
tui_old_rl_outstream that is still 0x0 (whatever RL got initialised), then
kaboom.

To me a fix 'could be' 
<    tui_old_rl_outstream = rl_outstream;
>    tui_old_rl_outstream = rl_outstream ? rl_outstream:tui_rl_outstream;

Because even though RL is not inited at that time, TUI is and then this is what
could be backed up.

I tried this on both 9.1 and 9.2 and it solve here.

BUT it may not be the final way to do this.

Good luck!
Phi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-27  7:00 ` phi.debian at gmail dot com
@ 2020-06-06 18:18 ` tromey at sourceware dot org
  2020-06-09  7:43 ` phi.debian at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2020-06-06 18:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Dup

*** This bug has been marked as a duplicate of bug 25348 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-06 18:18 ` tromey at sourceware dot org
@ 2020-06-09  7:43 ` phi.debian at gmail dot com
  2020-06-09 10:41 ` phi.debian at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-06-09  7:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

--- Comment #4 from Phi <phi.debian at gmail dot com> ---
Oops didn't spotted it...
Cheers,
Phi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
                   ` (4 preceding siblings ...)
  2020-06-09  7:43 ` phi.debian at gmail dot com
@ 2020-06-09 10:41 ` phi.debian at gmail dot com
  2020-06-09 17:27 ` cbiesinger at google dot com
  2020-06-09 19:48 ` phi.debian at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-06-09 10:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

--- Comment #5 from Phi <phi.debian at gmail dot com> ---
Hi Tromey,

I have a 'patch' to implement a tiny enhancement of the TUI I suggested here
http://sourceware-org.1504.n7.nabble.com/TUI-enhancement-suggestion-td636234.html

I wonder if I can post the patch to gdb-patches or if I should wait someone
review it ?

I wonder as well how to produce the patch suitable for the mailing list. So
for I produced with

$ git format-patch -1 HEAD

Dunno if this is enough?

I never sent a patch to a list, would be my 1st try.

Cheers,
Phi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
                   ` (5 preceding siblings ...)
  2020-06-09 10:41 ` phi.debian at gmail dot com
@ 2020-06-09 17:27 ` cbiesinger at google dot com
  2020-06-09 19:48 ` phi.debian at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cbiesinger at google dot com @ 2020-06-09 17:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

Christian Biesinger <cbiesinger at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbiesinger at google dot com

--- Comment #6 from Christian Biesinger <cbiesinger at google dot com> ---
Hi Phi,

Yes, using git-format-patch + git-send-email is the preferred way to send
patches. See https://sourceware.org/gdb/wiki/ContributionChecklist for some
details especially regarding ChangeLog entries. Thanks for writing the patch!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug tui/26036] GDB core dump TUI + rl
  2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
                   ` (6 preceding siblings ...)
  2020-06-09 17:27 ` cbiesinger at google dot com
@ 2020-06-09 19:48 ` phi.debian at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: phi.debian at gmail dot com @ 2020-06-09 19:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26036

--- Comment #7 from Phi <phi.debian at gmail dot com> ---
On Tuesday, June 9, 2020, cbiesinger at google dot com <
sourceware-bugzilla@sourceware.org> wrote:

> https://sourceware.org/bugzilla/show_bug.cgi?id=26036
>
> Christian Biesinger <cbiesinger at google dot com> changed:
>
>            What    |Removed                     |Added
> ------------------------------------------------------------
> ----------------
>                  CC|                            |cbiesinger at google dot
> com
>
> --- Comment #6 from Christian Biesinger <cbiesinger at google dot com> ---
> Hi Phi,
>
> Yes, using git-format-patch + git-send-email is the preferred way to send
> patches. See https://sourceware.org/gdb/wiki/ContributionChecklist for
> some
> details especially regarding ChangeLog entries. Thanks for writing the
> patch!
>
> --
> You are receiving this mail because:
> You reported the bug.


Ok i did that at least for a first try. I got to review in you link the
correct way to attach it in the mail in my attempt i made an attachement
but may be people prefer an inline text....

Thanx again
Phi

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-06-09 19:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  6:02 [Bug tui/26036] New: GDB core dump TUI + rl phi.debian at gmail dot com
2020-05-27  5:58 ` [Bug tui/26036] " phi.debian at gmail dot com
2020-05-27  6:20 ` phi.debian at gmail dot com
2020-05-27  7:00 ` phi.debian at gmail dot com
2020-06-06 18:18 ` tromey at sourceware dot org
2020-06-09  7:43 ` phi.debian at gmail dot com
2020-06-09 10:41 ` phi.debian at gmail dot com
2020-06-09 17:27 ` cbiesinger at google dot com
2020-06-09 19:48 ` phi.debian at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).