Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Regression with -D_GLIBCXX_DEBUG  [Re: [PATCH 1/5] Make delim_string_to_char_ptr_vec return an std::vector]
Date: Tue, 10 Apr 2018 19:58:00 -0000	[thread overview]
Message-ID: <20180410195811.GA16998@host1.jankratochvil.net> (raw)
In-Reply-To: <20180225163247.20157-1-simon.marchi@polymtl.ca>

Hi,

commit e80aaf6183c6692ecc167bf26cbdc53f8f1a55f0 (HEAD)
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Mar 2 23:22:06 2018 -0500
    Make delim_string_to_char_ptr_vec return an std::vector

/usr/include/c++/7/debug/safe_iterator.h:297:
Error: attempt to increment a singular iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffd140 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<char, gdb::xfree_deleter<char> >*, std::__cxx1998::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > >, std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > > (mutable iterator);
      state = singular;
      references sequence with type 'std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > >' @ 0x0x265db40
    }
#4  0x000000000078f893 in auto_load_safe_path_vec_update () at auto-load.c:212


On Sun, 25 Feb 2018 17:32:43 +0100, Simon Marchi wrote:
>    /* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC
>       element.  */
> -  for (ix = 0; ix < len; ix++)
> +  for (gdb::unique_xmalloc_ptr<char> &in_vec : auto_load_safe_path_vec)
>      {
...
> -	  VEC_safe_push (char_ptr, auto_load_safe_path_vec,
> -			 real_path.release ());
> +	  auto_load_safe_path_vec.push_back (std::move (real_path));
>  	}
>      }
>  }

The iterator breaks when moving its std::vector data underneath it.
This is why the original C code did not use a pointer there.


Jan


  parent reply	other threads:[~2018-04-10 19:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-25 16:32 [PATCH 1/5] Make delim_string_to_char_ptr_vec return an std::vector Simon Marchi
2018-02-25 16:32 ` [PATCH 3/5] Make program_space::deleted_solibs a vector of std::string Simon Marchi
2018-02-25 16:32 ` [PATCH 4/5] C++ify charsets Simon Marchi
2018-02-25 16:33 ` [PATCH 5/5] Remove free_char_ptr_vec Simon Marchi
2018-02-25 16:47 ` [PATCH 2/5] C++ify program_space Simon Marchi
2018-03-03  4:23 ` [PATCH 1/5] Make delim_string_to_char_ptr_vec return an std::vector Simon Marchi
2018-04-10 19:58 ` Jan Kratochvil [this message]
2018-04-10 20:33   ` Regression with -D_GLIBCXX_DEBUG [Re: [PATCH 1/5] Make delim_string_to_char_ptr_vec return an std::vector] Simon Marchi
2018-04-10 20:39     ` Jan Kratochvil
2018-04-10 20:52       ` Simon Marchi

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=20180410195811.GA16998@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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