Bug 2077932 - lldb don't print std::vector variables correctly
Summary: lldb don't print std::vector variables correctly
Keywords:
Status: NEW
Alias: None
Product: DevTools
Classification: Red Hat
Component: lldb
Version: 2022.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 2019.3
Assignee: Tom Stellard
QA Contact: Jesus Checa
URL:
Whiteboard:
Depends On:
Blocks: 2082508
TreeView+ depends on / blocked
 
Reported: 2022-04-22 15:45 UTC by Jesus Checa
Modified: 2026-11-24 19:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2082508 (view as bug list)
Environment:
Last Closed:
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
My security (11.09 KB, text/plain)
2026-11-24 19:29 UTC, Shawonsrs
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DTS-365 0 None None None 2022-04-22 15:56:54 UTC

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


Note You need to log in before you can comment on or make changes to this bug.