Bug 2077932

Summary: lldb don't print std::vector variables correctly
Product: DevTools Reporter: Jesus Checa <jchecahi>
Component: lldbAssignee: Tom Stellard <tstellar>
Status: NEW --- QA Contact: Jesus Checa <jchecahi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2022.4CC: jistone, sipoyare, srssideatul
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: 2019.3Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2082508 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2082508    
Attachments:
Description Flags
My security none

Description Jesus Checa 2022-04-22 15:45:23 UTC
Description of problem:
lldb prints std::vector variables as if they had size 0. Given the  following reproducer:
// test.cpp
#include <stdio.h>
#include <vector>
int
main ()
{
  std::vector<int> v (1, 2);
  std::vector<int>::iterator it(v.begin());
  return 0;
}

When printing the variable "v" with lldb, it should show size=1 and the value of the elements inside the vector (in this case, "[0] = 2"). Instead, lldb prints a vector with size 0 and no elements.

Version-Release number of selected component (if applicable):
* llvm-toolset-14.0-lldb-14.0.0-1
* llvm-toolset-14.0-python3-lldb-14.0.0-1

How reproducible:
100%

Steps to Reproduce:
1. g++ -g test.cpp
2. lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out

Actual results:
(lldb) p v
(std::vector<int, std::allocator<> >) $0 = size=0 {}

Expected results:
(lldb) p v
(std::vector<int, std::allocator<> >) $0 = size=1 {
  [0] = 2
}


Additional info:
Found by this testcase https://src.fedoraproject.org/rpms/lldb/blob/rawhide/f/tests/python-embedded-interpreter

Tested with llvm-toolset-13.0-lldb-13.0.1-1, using the same binary (no recompiled), in the same system/environment, and the issue does not reproduce.

Comment 1 Shawonsrs 2026-11-24 19:29:33 UTC
Created attachment 2164187 [details]
My security

Show me