When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
46 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
https://stackoverflow.com/questions/4985414/how-to-enable-gdb-pretty-printing-for-c-stl-objects-in-eclipse-cdt ? might be similar process
I'm trying to add pretty printing for STL objects in eclipse cdt. I tried to follow the steps described here:
http://sourceware.org/gdb/wiki/STLSupport
I checked out the python folder, but I can'...
How to print the elements of a C++ std::vector with GNU Debugger GDB ? Consider the following code test.cpp: #include using namespace std; int main (...)
This one might work too?
I've already seen all these links when trying to figure it out by myself but I'll try again just incase I missed something
there are pretty printers for most STL types bundled with libstdc++, at least on linux
I'm guessing either they are not bundled or gdb cannot pick them up; or whatever ide you're using just ignores them
Damn, if only we could use them for ostream <<
#include <iostream>
#include <vector>
int main() {
std::vector<int> myVec = {1, 2, 5, 6, 7};
std::cin.get();
}
g++ test.cpp -g
`gdb a.exe
Reading symbols from a.exe...
(gdb) break test.cpp:6
Breakpoint 1 at 0x140001478: file main.cpp, line 6.
(gdb) run
[New Thread 11300.0xc88]
Thread 1 hit Breakpoint 1, main () at test.cpp:6
6 std::cin.get();
(gdb) print myVec
$1 = {<std::_Vector_base<int, std::allocator<int> >> = {
_M_impl = {<std::allocator<int>> = {<std::__new_allocator<int>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<int, std::allocator<int> >::_Vector_impl_data> = {_M_start = 0x14e645616a0, _M_finish = 0x14e645616b4, _M_end_of_storage = 0x14e645616b4}, <No data fields>}}, <No data fields>}
(gdb)
`
@rapid dune Has your question been resolved? If so, run !solved :)
unfortunetly not wheatly
I've made some progress
I found a link for a .gdbinit file that can print stl containers https://gist.github.com/skyscribe/3978082
the problem is when I run gdb it tells me:
I added the lines it told me into the file but the msg won't go away
?!?!?!??!
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.
!howto ask
Anyone can ask a question in our programming channels. Following the guide Writing The Perfect Question is recommended.
State your problem clearly and provide all necessary details:
Provide the relevant code in the message, and format it nicely with a code block*. If it's too much for one message, you can upload it:
you misunderstand the error
you added the add-load-safe-path ... line to a file that gdb never actually reads
so obviously it has no effect
Do you know how I could fix that?
do $env:HOME = "C:\\Users\\jakec", then try running gdb again
there was a typo, fixed now
@agile goblet sry it took my a while... I'm a little confused, where should I run that command?
in powershell
ahh i was using cmd
then what is this?
that was before
Now i'm having a whole bunch of issues:
$env:HOME = "C:\\Users\\jakec" every time I want to use it which means vscode debug won't workbut does pretty printing work at least?
yup
you mean like this?
$1 = std::vector of length 3, capacity 4 = {std::vector of length 1, capacity 1 = {"1"}, std::vector of length 1, capacity 1 = {"2"}, std::vector of length 1, capacity 1 = {"3"}}
- gdb only loads .gdbinit if I'm in C:\Users\jakec
that does look odd; does it print anything when the file is not loaded?
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.
@agile goblet It doesn't look like that but that is my desired result