ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate
@ 2019-12-06 13:16 Aleksei Nikiforov
  2019-12-06 13:16 ` [devel] [PATCH for apt 2/2] Fix pointer arithmetics Aleksei Nikiforov
  2019-12-08 22:50 ` [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate Dmitry V. Levin
  0 siblings, 2 replies; 34+ messages in thread
From: Aleksei Nikiforov @ 2019-12-06 13:16 UTC (permalink / raw)
  To: devel; +Cc: Aleksei Nikiforov

---
 apt/apt-pkg/contrib/mmap.cc | 15 +++++++++++++++
 apt/doc/apt.conf.5.sgml     |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/apt/apt-pkg/contrib/mmap.cc b/apt/apt-pkg/contrib/mmap.cc
index a3b06cc..cf01be9 100644
--- a/apt/apt-pkg/contrib/mmap.cc
+++ b/apt/apt-pkg/contrib/mmap.cc
@@ -265,6 +265,21 @@ std::experimental::optional<map_ptrloc> DynamicMMap::Allocate(unsigned long Item
    // No pool is allocated, use an unallocated one
    if (I == Pools + PoolCount)
    {
+      static const bool debug_grow = _config->FindB("Debug::DynamicMMap::Allocate", false);
+
+      if (debug_grow)
+      {
+         Pool *pool_iter = Pools;
+         size_t pool_idx = 0;
+
+         _error->Warning(_("DynamicMMap::Allocate: allocating item of size %lu"), ItemSize);
+
+         for (; pool_idx < PoolCount; ++pool_iter, ++pool_idx)
+         {
+            _error->Warning(_("DynamicMMap::Allocate: Pool %zu, item size: %lu, start: %lu, count: %lu"), pool_idx, pool_iter->ItemSize, pool_iter->Start, pool_iter->Count);
+         }
+      }
+
       // Woops, we ran out, the calling code should allocate more.
       if (Empty == 0)
       {
diff --git a/apt/doc/apt.conf.5.sgml b/apt/doc/apt.conf.5.sgml
index 0a72e45..72fc0c3 100644
--- a/apt/doc/apt.conf.5.sgml
+++ b/apt/doc/apt.conf.5.sgml
@@ -526,7 +526,7 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
    disable the inclusion of statfs data in CDROM IDs.
    </para><para>
    To debug issues related to dynamic memory allocation, an option
-   <literal/Debug::DynamicMMap::Grow/ may be used.
+   <literal/Debug::DynamicMMap::Grow/ and <literal/Debug::DynamicMMap::Allocate/ may be used.
    </para>
  </RefSect1>
  
-- 
2.24.0



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

end of thread, other threads:[~2019-12-13  8:01 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 13:16 [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate Aleksei Nikiforov
2019-12-06 13:16 ` [devel] [PATCH for apt 2/2] Fix pointer arithmetics Aleksei Nikiforov
2019-12-06 13:36   ` Ivan A. Melnikov
2019-12-06 15:32     ` Aleksei Nikiforov
2019-12-06 15:36     ` [devel] [PATCH for apt 2/2 v2] " Aleksei Nikiforov
2019-12-07 14:52       ` Andrey Savchenko
2019-12-08 22:56         ` Dmitry V. Levin
2019-12-09  6:54         ` Aleksei Nikiforov
2019-12-12 19:20           ` Andrey Savchenko
2019-12-13  7:58             ` Aleksei Nikiforov
2019-12-08 23:21       ` Dmitry V. Levin
2019-12-09  7:08         ` Aleksei Nikiforov
2019-12-10  0:07           ` Dmitry V. Levin
2019-12-10  8:18             ` Aleksei Nikiforov
2019-12-10 10:20               ` Dmitry V. Levin
2019-12-10 10:58                 ` Aleksei Nikiforov
2019-12-10 22:20                   ` Dmitry V. Levin
2019-12-11  7:50                     ` Aleksei Nikiforov
2019-12-12 19:43                       ` Andrey Savchenko
2019-12-13  8:01                         ` Aleksei Nikiforov
2019-12-08 23:31   ` [devel] [PATCH for apt 2/2] " Dmitry V. Levin
2019-12-09  7:09     ` Aleksei Nikiforov
2019-12-09  7:16     ` [devel] [PATCH for apt 2/2 v3] " Aleksei Nikiforov
2019-12-09 23:54   ` [devel] [PATCH apt 0/3] Fix 0.5.15lorg2-alt70~9 fallout Dmitry V. Levin
2019-12-09 23:56     ` [devel] [PATCH apt 1/3] apt-pkg/cacheiterators.h: revert #include <set> Dmitry V. Levin
2019-12-09 23:56     ` [devel] [PATCH apt 2/3] apt-pkg/contrib/mmap.cc: revert confusing change of Flags to this->Flags Dmitry V. Levin
2019-12-09 23:56     ` [devel] [PATCH apt 3/3] Fix UB in pointer arithmetic Dmitry V. Levin
2019-12-10  8:18       ` Aleksei Nikiforov
2019-12-08 22:50 ` [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate Dmitry V. Levin
2019-12-09  6:58   ` Aleksei Nikiforov
2019-12-09 10:24     ` Dmitry V. Levin
2019-12-09 11:03       ` [devel] [PATCH for apt 1/2 v3] Add Debug::DynamicMMap::Allocate option Aleksei Nikiforov
2019-12-09 22:59         ` Dmitry V. Levin
2019-12-09  7:00   ` [devel] [PATCH for apt 1/2 v2] Add option for debugging Debug::DynamicMMap::Allocate Aleksei Nikiforov

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git