Portál AbcLinuxu, 6. prosince 2025 00:50
38 void FileDictionary::activate()
39 {
40 index.clear();
41 std::ifstream f(INDEX_FILENAME);
42 if (f.is_open())
43 {
44 ***string line;
45 std::string temp;
46 gulong pos;
47 while(std::getline(f, temp, '\t') >> pos)
48 {
49 line = temp;
50 index.insert(std::pair<****ustring, gulong>(line,pos));
51 f.ignore();
52 }
53 }
54 else
55 exit(1);
56
57 fdictionary.close();
58 fdictionary.open(DICTIONARY_FILENAME);
59 if (!fdictionary.is_open())
60 exit(1);
61 }
$ gdb program
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) break file-dictionary.cpp:40
Breakpoint 1 at 0x804fdc2: file file-dictionary.cpp, line 40.
(gdb) run
Starting program: program
[Thread debugging using libthread_db enabled]
[New Thread -1232501056 (LWP 19194)]
[Switching to Thread -1232501056 (LWP 19194)]
Breakpoint 1, FileDictionary::activate (this=0x80c2200) at file-dictionary.cpp:41
41 std::ifstream f(INDEX_FILENAME);
(gdb) next
696 _M_impl._M_node_count = 0;
(gdb) next
693 _M_leftmost() = _M_end();
(gdb) next
695 _M_rightmost() = _M_end();
(gdb) next
446 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
(gdb) next
574 basic_istream(): _M_gcount(streamsize(0)) { }
(gdb) next
446 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
(gdb) next
574 basic_istream(): _M_gcount(streamsize(0)) { }
(gdb) next
446 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
(gdb) next
574 basic_istream(): _M_gcount(streamsize(0)) { }
(gdb) next
446 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
(gdb) next
574 basic_istream(): _M_gcount(streamsize(0)) { }
(gdb) next
443 : __istream_type(), _M_filebuf()
(gdb) next
445 this->init(&_M_filebuf);
(gdb) next
497 if (!_M_filebuf.open(__s, __mode | ios_base::in))
(gdb) next
498 this->setstate(ios_base::failbit);
(gdb) next
144 { this->clear(this->rdstate() | __state); }
(gdb) next
248 { return _M_file.is_open(); }
(gdb) next
42 if (f.is_open())
(gdb) next
60 exit(1);
(gdb)
Navrhované řešení - rozliš ty dva exity od sebe nějak. A vůbec, jak to že exituješ a přitom ani neřekneš uživateli, proč?
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.