bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ANN: ncurses-6.0-20170624


From: Allen Hewes
Subject: Re: ANN: ncurses-6.0-20170624
Date: Sun, 25 Jun 2017 20:50:01 +0000

On 6/25/2017 6:02, Thomas Dickey wrote:
> On Sun, Jun 25, 2017 at 01:28:42AM +0000, Thomas Dickey wrote:
> ...
>> 20170624
>>      + modify c++/etip.h.in to accommodate deprecation of throw() and
>>        throws() in c++17 (prompted by patch by Romain Geissler).
>>      + remove some incorrect calls for memory-leaks from 20170617 changes
>>        (report by Allen Hewes).
> 
> This should get the set of changes back on track.  I noticed some
> problem with the c++ demo (which wouldn't affect gdb, but might have
> a common root cause).
> 

Hi Thomas,

Thank you for looking into MinGW issues. I realize it's not everyone's
cup of tea. There's still multiple free() happening.

When I build gdb, I don't use the Readline they include. I use the
offical Readline sources with MinGW-w64 patches. I've been doing this
for a while now with two major releases of Readline (6/7).

from gdb:
init_page_info () at ../../../../src/gdb-7.12.1/gdb/utils.c:1717

gdb into readline:
in rl_reset_terminal (address@hidden) at
../../../src/readline-7.0/terminal.c:631
http://git.savannah.gnu.org/cgit/readline.git/tree/terminal.c?h=readline-7.0#n631

readline into ncurses:
in _rl_init_terminal_io (address@hidden) at
../../../src/readline-7.0/terminal.c:488
http://git.savannah.gnu.org/cgit/readline.git/tree/terminal.c?h=readline-7.0#n488

ncurses:
in tgetent (bufp=<optimized out>, address@hidden
<_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:207

bufp = (initialized memory)
http://git.savannah.gnu.org/cgit/readline.git/tree/terminal.c?h=readline-7.0#n484

name = "dumb"
http://git.savannah.gnu.org/cgit/readline.git/tree/terminal.c?h=readline-7.0#n452

I noticed a few things below:

1) the fist call into _nc_free_*() functions is _nc_free_termtype() and
not _nc_free_termtype2().

2) the second call into _nc_free_termtype2 is where the trouble is. a
free() has already happened.

3) in the really_free_termtype() you don't free all of the other string
members of ptr. And there's no if (freeStrings) guard around other
members that are strings (ptr->Booleans, etc).

call paths:
tgetent()
_nc_free_termtype()
_nc_free_termtype2()
_nc_free_termtype2() <- is where the trouble happens

C:\Users\Allen Hewes>gdb --args gdbt --tui
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 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 "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gdbt...done.
(gdb) break tgetent
Breakpoint 1 at 0x74bda2: file
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c, line 206.
(gdb) break _nc_free_termtype
Breakpoint 2 at 0x767464: file
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c, line 73.
(gdb) break _nc_free_termtype2
Breakpoint 3 at 0x767478: file
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c, line 80.
(gdb) r
Starting program: C:\mingw64\bin\gdbt.exe --tui
[New Thread 11928.0x77b0]
[New Thread 11928.0x9134]
[New Thread 11928.0xc31c]
[New Thread 11928.0xb510]

Thread 1 hit Breakpoint 1, tgetent (
    bufp=0x15788820
"\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º"...,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:206
206     {
(gdb) c
Continuing.

Thread 1 hit Breakpoint 2, _nc_free_termtype (address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:73
73      {
(gdb) bt
#0  _nc_free_termtype (address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:73
#1  0x0000000000749032 in del_curterm_sp (address@hidden,
address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_cur_term.c:148
#2  0x0000000000758556 in drv_CanHandle (TCB=0x15789840, tname=0xa116d4
<_rl_possible_control_prefixes+244> "dumb",
    errret=0x130efb6c) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/tinfo_driver.c:180
#3  0x000000000075296b in _nc_get_driver (address@hidden,
    address@hidden <_rl_possible_control_prefixes+244> "dumb",
address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/base/lib_driver.c:67
#4  0x000000000074af11 in _nc_setupterm_ex (address@hidden,
tname=<optimized out>,
    address@hidden <_rl_possible_control_prefixes+244> "dumb",
address@hidden, address@hidden,
    address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_setup.c:719
#5  0x000000000074b31e in tgetent_sp (sp=0x0,
    bufp=0x15788820
"\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º"...,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:103
#6  0x000000000074bdbb in tgetent (bufp=<optimized out>,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:207
#7  0x00000000006660e0 in _rl_init_terminal_io
(address@hidden) at
../../../src/readline-7.0/terminal.c:488
#8  0x000000000066649d in rl_reset_terminal
(address@hidden) at
../../../src/readline-7.0/terminal.c:631
#9  0x0000000000612574 in init_page_info () at
../../../../src/gdb-7.12.1/gdb/utils.c:1717
#10 0x0000000000611644 in gdb_init (argv0=<optimized out>) at
../../../../src/gdb-7.12.1/gdb/top.c:2197
#11 0x0000000000546bea in captured_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:865
#12 0x00000000005473b7 in gdb_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:1159
#13 0x00000000004015e8 in main (argc=2, argv=0x15784730) at
../../../../src/gdb-7.12.1/gdb/gdb.c:32
(gdb) print *ptr
$1 = {term_names = 0x0, str_table = 0x0, Booleans = 0x0, Numbers = 0x0,
Strings = 0x0, ext_str_table = 0x0, ext_Names = 0x0,
  num_Booleans = 0, num_Numbers = 0, num_Strings = 0, ext_Booleans = 0,
ext_Numbers = 0, ext_Strings = 0}
(gdb) ptype ptr
type = struct termtype {
    char *term_names;
    char *str_table;
    char *Booleans;
    short int *Numbers;
    char **Strings;
    char *ext_str_table;
    char **ext_Names;
    short unsigned int num_Booleans;
    short unsigned int num_Numbers;
    short unsigned int num_Strings;
    short unsigned int ext_Booleans;
    short unsigned int ext_Numbers;
    short unsigned int ext_Strings;
} *
(gdb) c
Continuing.

Thread 1 hit Breakpoint 3, _nc_free_termtype2 (address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:80
80      {
(gdb) bt
#0  _nc_free_termtype2 (address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:80
#1  0x000000000074903e in del_curterm_sp (address@hidden,
address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_cur_term.c:150
#2  0x0000000000758556 in drv_CanHandle (TCB=0x15789840, tname=0xa116d4
<_rl_possible_control_prefixes+244> "dumb",
    errret=0x130efb6c) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/tinfo_driver.c:180
#3  0x000000000075296b in _nc_get_driver (address@hidden,
    address@hidden <_rl_possible_control_prefixes+244> "dumb",
address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/base/lib_driver.c:67
#4  0x000000000074af11 in _nc_setupterm_ex (address@hidden,
tname=<optimized out>,
    address@hidden <_rl_possible_control_prefixes+244> "dumb",
address@hidden, address@hidden,
    address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_setup.c:719
#5  0x000000000074b31e in tgetent_sp (sp=0x0,
    bufp=0x15788820
"\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º"...,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:103
#6  0x000000000074bdbb in tgetent (bufp=<optimized out>,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:207
#7  0x00000000006660e0 in _rl_init_terminal_io
(address@hidden) at
../../../src/readline-7.0/terminal.c:488
#8  0x000000000066649d in rl_reset_terminal
(address@hidden) at
../../../src/readline-7.0/terminal.c:631
#9  0x0000000000612574 in init_page_info () at
../../../../src/gdb-7.12.1/gdb/utils.c:1717
#10 0x0000000000611644 in gdb_init (argv0=<optimized out>) at
../../../../src/gdb-7.12.1/gdb/top.c:2197
#11 0x0000000000546bea in captured_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:865
#12 0x00000000005473b7 in gdb_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:1159
#13 0x00000000004015e8 in main (argc=2, argv=0x15784730) at
../../../../src/gdb-7.12.1/gdb/gdb.c:32
(gdb) print *ptr
$2 = {term_names = 0x0, str_table = 0x0, Booleans = 0x0, Numbers = 0x0,
Strings = 0x0, ext_str_table = 0x0, ext_Names = 0x0,
  num_Booleans = 0, num_Numbers = 0, num_Strings = 0, ext_Booleans = 0,
ext_Numbers = 0, ext_Strings = 0}
(gdb) ptype ptr
type = struct termtype2 {
    char *term_names;
    char *str_table;
    char *Booleans;
    int *Numbers;
    char **Strings;
    char *ext_str_table;
    char **ext_Names;
    short unsigned int num_Booleans;
    short unsigned int num_Numbers;
    short unsigned int num_Strings;
    short unsigned int ext_Booleans;
    short unsigned int ext_Numbers;
    short unsigned int ext_Strings;
} *
(gdb) c
Continuing.

Thread 1 hit Breakpoint 3, _nc_free_termtype2 (address@hidden)
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:80
80      {
(gdb) bt
#0  _nc_free_termtype2 (address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/free_ttype.c:80
#1  0x000000000074b057 in _nc_setupterm_ex (address@hidden,
tname=<optimized out>,
    address@hidden <_rl_possible_control_prefixes+244> "dumb",
address@hidden, address@hidden,
    address@hidden) at
../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_setup.c:724
#2  0x000000000074b31e in tgetent_sp (sp=0x0,
    bufp=0x15788820
"\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º\rd-º"...,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:103
#3  0x000000000074bdbb in tgetent (bufp=<optimized out>,
address@hidden <_rl_possible_control_prefixes+244> "dumb")
    at ../../../../src/ncurses-6.0-20170624/ncurses/tinfo/lib_termcap.c:207
#4  0x00000000006660e0 in _rl_init_terminal_io
(address@hidden) at
../../../src/readline-7.0/terminal.c:488
#5  0x000000000066649d in rl_reset_terminal
(address@hidden) at
../../../src/readline-7.0/terminal.c:631
#6  0x0000000000612574 in init_page_info () at
../../../../src/gdb-7.12.1/gdb/utils.c:1717
#7  0x0000000000611644 in gdb_init (argv0=<optimized out>) at
../../../../src/gdb-7.12.1/gdb/top.c:2197
#8  0x0000000000546bea in captured_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:865
#9  0x00000000005473b7 in gdb_main (address@hidden) at
../../../../src/gdb-7.12.1/gdb/main.c:1159
#10 0x00000000004015e8 in main (argc=2, argv=0x15784730) at
../../../../src/gdb-7.12.1/gdb/gdb.c:32
(gdb) print *ptr
$3 = {term_names = 0xfeeefeeefeeefeee <error: Cannot access memory at
address 0xfeeefeeefeeefeee>,
  str_table = 0xfeeefeeefeeefeee <error: Cannot access memory at address
0xfeeefeeefeeefeee>,
  Booleans = 0xfeeefeeefeeefeee <error: Cannot access memory at address
0xfeeefeeefeeefeee>, Numbers = 0xfeeefeeefeeefeee,
  Strings = 0xfeeefeeefeeefeee, ext_str_table = 0xfeeefeeefeeefeee
<error: Cannot access memory at address 0xfeeefeeefeeefeee>,
  ext_Names = 0xfeeefeeefeeefeee, num_Booleans = 65262, num_Numbers =
65262, num_Strings = 65262, ext_Booleans = 65262,
  ext_Numbers = 65262, ext_Strings = 65262}
(gdb) ptype ptr
type = struct termtype2 {
    char *term_names;
    char *str_table;
    char *Booleans;
    int *Numbers;
    char **Strings;
    char *ext_str_table;
    char **ext_Names;
    short unsigned int num_Booleans;
    short unsigned int num_Numbers;
    short unsigned int num_Strings;
    short unsigned int ext_Booleans;
    short unsigned int ext_Numbers;
    short unsigned int ext_Strings;
} *
(gdb) c
Continuing.
warning: Critical error detected c0000374

Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
0x00007ff9f0b18243 in ntdll!RtlpNtMakeTemporaryKey () from
C:\WINDOWS\SYSTEM32\ntdll.dll
(gdb)

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]