|
[Sponsors] |
Gdb newbie question about printing strings out and confusion about Word bs |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 3, 2006, 22:17 |
Hi,
I'm currently into file
|
#1 |
Guest
Posts: n/a
|
Hi,
I'm currently into fileName.C - line 142: //////////////////////////////////// // Return the components of the file name as a wordList wordList fileName::components(const char delimiter) const { wordList wrdList(20); size_type start=0, end=0; label nWords=0; while ((end = find(delimiter, start)) != npos) { wrdList[nWords++] = substr(start, end-start); if (nWords == wrdList.size()) <--- THIS is where program execution stopped //////////////////////////////////// Am I right that a wordlist has something to do with a UList or something? I have a backtrace like this: (gdb) bt #0 Foam::fileName::components (this=0xbfd77774, delimiter=47 '/') at primitives/strings/fileName/fileName.C:142 #1 0xb76184be in argList (this=0xbfd787c8, argc=@0xbfd78a90, argv=@0xbfd78a94) at global/argList/argList.C:96 #2 0x0805bf5a in main (argc=Cannot access memory at address 0x0 ) at setRootCase.H:1 Now, I would like to see what's inside the first position of the wordList - it's a substring, so it must be some kind of string, right?: (gdb) p nWords $10 = 1 (gdb) p wrdList[0] $11 = (const Foam::word &) @0x80cdda4: {<foam::string> = {<std::basic_string<char,std::char_traits<char>,st d::allocator<char> >> = { static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<no>}, <no>}, _M_p = 0xb75015bc ""}}, static debug = 0, static null = {<std::basic_string<char,std::char_traits<char>,st d::allocator<char> >> = { static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<no>}, <no>}, _M_p = 0xb75015bc ""}}, static debug = 0, static null = <same>}}, static debug = 2, static null = {<foam::string> = {<std::basic_string<char,std::char_traits<char>,st d::allocator<char> >> = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<no>}, <no>}, _M_p = 0xb75015bc ""}}, static debug = 0, static null = {<std::basic_string<char,std::char_traits<char>,st d::allocator<char> >> = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<no>}, <no>}, _M_p = 0xb75015bc ""}}, static debug = 0, static null = <same>}}, static debug = 2, static null = <same>}} (gdb) I don't understand this output.... The index should be 0, because nWords was just incremented and confirmed to be 1. Any help? Reason for asking: I noticed that the list of arguments seem to be split up and stored in a wordList... It is *really* bugging me that I can't just type: (gdb) p wrdList (enter) ... In order to see the individual list of words. Yet, I think it must be possible to access the list of words by pointers or something... So I guess I have to figure out how to access the string using pointers or something....? Okay, all tips and tricks for using gdb are welcome. ///////////// Another derived question /////////// I tried where gdb wrote something about "no line number information available" <---> IIRC. That was yesterday, when I think I debugged into something inside ~/OpenFOAM/OpenFOAM-1.3/src/finiteVolume That was actually a very interesting place to look and find information about the mesh (I assume), etc - so I would really like to be able to debug into that code... Any suggestions for me about where to set my breakpoint to learn about how it reads the mesh-information? And what the cause of this "no line information"-error? Was I step'ping into some /lib/???.so file or was something not compiled with debug information included? |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A newbie question | janusz | OpenFOAM Running, Solving & CFD | 23 | October 16, 2013 04:38 |
Newbie CFX Question | Vedran | CFX | 1 | June 12, 2006 07:50 |
Newbie question on Yplus and some | Caroline | FLUENT | 2 | September 7, 2005 10:38 |
Equations in MS word? | eric | FLUENT | 8 | November 16, 2003 06:12 |
newbie question | Roger | Siemens | 2 | December 11, 2002 09:20 |