It looks like your implementation of hash_map is not working correctly -- all lookups are failing. You might try writing a little test for hash_map itself that would be easier to debug.
On Tue, Jul 14, 2009 at 6:27 PM, vikram <patilvik...@gmail.com> wrote: > > Kenton & Monty, > > I added hack as followes in the hash.h > > // File changed ..... > > #if defined(HAVE_HASH_MAP) && defined(HAVE_HASH_SET) > #include HASH_MAP_H > #include HASH_SET_H > #elif defined (__xlC__) > #define MISSING_HASH > #include <unordered_map> > #include <unordered_set> > #else > #define MISSING_HASH > #include <map> > #include <set> > #endif > > namespace google { > namespace protobuf { > #if defined(MISSING_HASH) && defined(__xlC__) > > //@TODO > //Inherit hash_map from unordered_map > template <typename Key> > struct hash : public std::tr1::hash<Key> { > }; > > template <typename Key> > struct hash<const Key*> { > inline size_t operator()(const Key* key) const { > return reinterpret_cast<size_t>(key); > } > }; > > template <typename Key, typename Data, > typename HashFcn = hash<Key>, > typename EqualKey = std::equal_to<Key> > > class hash_map : public std::tr1::unordered_map<Key, Data, HashFcn , > EqualKey> { > > }; > > template <typename Key, > typename HashFcn = hash<Key>, > typename EqualKey = std::equal_to<Key> > > class hash_set : public std::tr1::unordered_set< > Key, HashFcn, EqualKey> { > }; > #elif defined(MISSING_HASH) > > File continues as it is > > Stack trace > > pthread_kill(??, ??) at 0xd01246b4 > _p_raise(??) at 0xd0124124 > raise.raise(??) at 0xd0375b28 > abort() at 0xd03d3e78 > google::protobuf::internal::LogMessage::Finish()(this = 0x2ff21e40), > line 171 in "common.cc" > google::protobuf::internal::LogFinisher::operator= > (google::protobuf::internal::LogMessage&)(this = 0x2ff21e38, other = & > (...)), line 176 in "common.cc" > protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto()(), line > 82 in "descriptor.pb.cc" > pthread_once(??, ??) at 0xd0115e78 > common.GoogleOnceInit(pthread_once_t*,void(*)())(0xf04a9d00, > 0xf04b15a0), line 114 in "once.h" > protobuf_AssignDescriptorsOnce()(), line 408 in "descriptor.pb.cc" > google::protobuf::FileOptions::descriptor()(), line 3862 in > "descriptor.pb.cc" > google::protobuf::FileOptions::GetDescriptor() const(this = > 0x2000e248), line 4190 in "descriptor.pb.cc" > google::protobuf::compiler::Parser::ParseOptionAssignment > (google::protobuf::Message*)(this = 0x2ff223b8, options = 0x2000e248), > line 659 in "parser.cc" > google::protobuf::compiler::Parser::ParseOption > (google::protobuf::Message*)(this = 0x2ff223b8, options = 0x2000e248), > line 1081 in "parser.cc" > google::protobuf::compiler::Parser::ParseTopLevelStatement > (google::protobuf::FileDescriptorProto*)(this = 0x2ff223b8, file = > 0x2ff22460), line 375 in "parser.cc" > google::protobuf::compiler::Parser::Parse > (google::protobuf::io::Tokenizer*,google::protobuf::FileDescriptorProto*) > (this = 0x2ff223b8, input = 0x2ff22368, file = 0x2ff22460), line 321 > in "parser.cc" > google::protobuf::compiler::SourceTreeDescriptorDatabase::FindFileByName > (const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > >&,google::protobuf::FileDescriptorProto*)(this = 0x2ff22688, filename > = &(...), output = 0x2ff22460), line 145 in "importer.cc" > TryFindFileInFallbackDatabase(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) > const(0x2ff226ac, 0x2000b9d8), line 1230 in "descriptor.cc" > NFS write error on host esfs3-lnx.actuate.com: 28. > File: userid=1104, groupid=1000 > FindFileByName(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) > const(0x2ff226ac, 0x2000b9d8), line 875 in "descriptor.cc" > google::protobuf::compiler::Importer::Import(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) > (this = 0x2ff22688, filename = &(...)), line 194 in "importer.cc" > > Protoc compiler aborted > > ./protoc google/protobuf/unittest.proto google/protobuf/ > unittest_empty.proto google/protobuf/unittest_import.proto google/ > protobuf/unittest_mset.proto google/protobuf/ > unittest_optimize_for.proto google/protobuf/ > unittest_embed_optimize_for.proto google/protobuf/ > unittest_custom_options.proto google/protobuf/compiler/cpp/ > cpp_test_bad_identifiers.proto -I. --cpp_out=. > libprotobuf ERROR google/protobuf/descriptor.cc:2215] Invalid proto > descriptor for file "google/protobuf/descriptor.proto": > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileDescriptorSet.file: > ".google.protobuf.FileDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileDescriptorProto.message_type: > ".google.protobuf.DescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileDescriptorProto.extension: > ".google.protobuf.FieldDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileDescriptorProto.options: > ".google.protobuf.FileOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.field: > ".google.protobuf.FieldDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.extension: > ".google.protobuf.FieldDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.nested_type: > ".google.protobuf.DescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.enum_type: > ".google.protobuf.EnumDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.extension_range: > ".google.protobuf.DescriptorProto.ExtensionRange" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.DescriptorProto.options: > ".google.protobuf.MessageOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FieldDescriptorProto.label: > ".google.protobuf.FieldDescriptorProto.Label" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FieldDescriptorProto.type: > ".google.protobuf.FieldDescriptorProto.Type" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FieldDescriptorProto.options: > ".google.protobuf.FieldOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.EnumDescriptorProto.value: > ".google.protobuf.EnumValueDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.EnumDescriptorProto.options: > ".google.protobuf.EnumOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.EnumValueDescriptorProto.options: > ".google.protobuf.EnumValueOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.ServiceDescriptorProto.method: > ".google.protobuf.MethodDescriptorProto" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.ServiceDescriptorProto.options: > ".google.protobuf.ServiceOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.MethodDescriptorProto.options: > ".google.protobuf.MethodOptions" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileOptions.optimize_for: > ".google.protobuf.FileOptions.OptimizeMode" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FileOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.MessageOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FieldOptions.ctype: > ".google.protobuf.FieldOptions.CType" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.FieldOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.EnumOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.EnumValueOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.ServiceOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.MethodOptions.uninterpreted_option: > ".google.protobuf.UninterpretedOption" is not defined. > libprotobuf ERROR google/protobuf/descriptor.cc:2218] > google.protobuf.UninterpretedOption.name: > ".google.protobuf.UninterpretedOption.NamePart" is not defined. > libprotobuf FATAL google/protobuf/descriptor.pb.cc:82] CHECK failed: > file != NULL: > gmake[2]: *** [unittest_proto_middleman] IOT/Abort trap (core dumped) > > Any suggestions? > > Thanks & Regards, > Vikram > > On Jul 13, 5:23 pm, Kenton Varda <ken...@google.com> wrote: > > And yes, I'd love a patch. :) > > > > On Mon, Jul 13, 2009 at 5:22 PM, Kenton Varda <ken...@google.com> wrote: > > > google/protobuf/stubs/hash.h already contains some hacks for hash_map. > To > > > support unordered_map, all we'd have to do is add another hack there > which > > > defines hash_map to be a subclass of unordered_map. Subclassing > effectively > > > functions as a template typedef here. > > > I would rather not replace the identifier "hash_map" with > "unordered_map" > > > in the actual code until the Google style guide rules on the issue. I > > > suspect that Google code will go on using hash_map with a similar hack > > > because updating our entire code base is just not worth the effort. > > > > > On Mon, Jul 13, 2009 at 5:13 PM, Monty Taylor <mord...@inaugust.com > >wrote: > > > > >> vikram wrote: > > >> > I have found out that with new xlC versions like 8.X onwards > hash_map > > >> > like functionality is supported but different name as unordered_map. > > >> > So it there any way you can to use this container without modifying > > >> > much of the code. In the code hash_map is used in many places. So > it > > >> > needs to be replaced with unordered_map with > > >> > xlC compiler on AIX. Please provide some idea. I was trying to do > > >> > template typedef but seems like I can not have all typenames while > > >> > doing that. > > > > >> I was actually just working on making an update to the m4 to detect > > >> unordered_map in Drizzle. (We swiped the hash_map detection macro) > > > > >> unordered_map is the name it's apparently going to land in C++0x as, > and > > >> is the name that it exists as in gcc 4.3 and 4.4. gcc still has > hash_map > > >> as well, but it throws a deprecated warning. > > > > >> Might not be a terrible idea to go ahead and shift to unordered_map > and > > >> then put in a mapping/typedef for hash_map if something doesn't have > u_m? > > > > >> (Kenton - would you be interested in a patch doing that?) > > > > >> > On Jul 1, 12:00 pm, Kenton Varda <ken...@google.com> wrote: > > >> >> Well, it looks like all of these are stuck in the same place -- in > the > > >> same > > >> >> call to hash_map::find(). This would seem to indicate that your > STL > > >> >> implementation is broken. It's also possible that the infinite > loop is > > >> >> actually in protobuf code, and the only reason we see it always > > >> breaking in > > >> >> the same find() call is because that's the most expensive part of > the > > >> loop. > > >> >> You could test this by breaking under gdb again, and then > repeatedly > > >> typing > > >> >> "finish" to make it run to completion of the current function call. > If > > >> it > > >> >> eventually gets back to protobuf code, then the problem is there, > > >> otherwise > > >> >> it's in the STL code. (Actually, I should have told you to do this > > >> >> originally, rather than the "collect multiple stack traces" > idea...) > > > > >> >> On Tue, Jun 30, 2009 at 7:36 PM, vikram <patilvik...@gmail.com> > wrote: > > > > >> >>> Hey Kenton, > > >> >>> This is compilation without STL implementation . I am > assuming > > >> >>> that if hash_map does not exist , google protocol buffer emulates > > >> >>> hash_map. I am pasting 3-4 instances of stack where protoc is in > > >> >>> infinite loop > > >> >>> #0 0xd1cfdc60 in > > > > >> > _Node::_Right__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__FPQ3_3std9_Tree_nodXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0 > > >> >>> (_P=0xf04ca4e0) at /usr/vacpp/include/xtree:154 > > >> >>> #1 0xd1d1bbdc in > > > > >> > _Lbound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0xf04ca4e0, _...@0x2ff2222c) at > /usr/vacpp/include/xtree.t:377 > > >> >>> #2 0xd1d22878 in > > > > >> > lower_bound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0xf04ca4e0, __classretu...@0x2ff21d70, _...@0x2ff2222c) at > /usr/ > > >> >>> vacpp/include/xtree:377 > > >> >>> #3 0xd1d28f34 in > > > > >> > find__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0xf04ca4e0, __classretu...@0x2ff21dd0, _...@0x2ff2222c) at > /usr/ > > >> >>> vacpp/include/xtree:365 > > >> >>> #4 0xd1d2fd34 in > > > > >> > ParseType__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf25FieldDescriptorProto_TypePQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0x2ff22278, > > >> >>> type=0x2ff21e24, type_name=0x2ff21e28) at > google/protobuf/compiler/ > > >> >>> parser.cc:1000 > > >> >>> #5 0xd1d31438 in > > > > >> > ParseMessageField__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf20FieldDescriptorProtoPQ3_6google8protobuf16RepeatedPtrFieldXTQ3_6google8protobuf15DescriptorProto_ > > >> >>> ( > > >> >>> this=0x2ff22278, field=0x2000f918, messages=0x2000f808) at > google/ > > >> >>> protobuf/compiler/parser.cc:443 > > >> >>> #6 0xd1d30f50 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageStatement > > >> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/ > > >> >>> parser.cc:428 > > >> >>> #7 0xd1d310c4 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageBlock > > >> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/ > > >> >>> parser.cc:402 > > >> >>> #8 0xd1d30c80 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageDefinition > > >> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/ > > >> >>> parser.cc:389 > > >> >>> #9 0xd1d30e28 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageStatement > > >> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/ > > >> >>> parser.cc:417 > > >> >>> #10 0xd1d310c4 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageBlock > > >> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/ > > >> >>> parser.cc:402 > > >> >>> #11 0xd1d30c80 in > > >> >>> google::protobuf::compiler::Parser::ParseMessageDefinition > > >> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/ > > >> >>> parser.cc:389 > > >> >>> #12 0xd1d3250c in > > >> >>> google::protobuf::compiler::Parser::ParseTopLevelStatement > > >> >>> (this=0x2ff22278, file=0x2ff22320) at google/protobuf/compiler/ > > >> >>> parser.cc:362 > > >> >>> #13 0xd1d32c80 in google::protobuf::compiler::Parser::Parse > > >> >>> (this=0x2ff22278, input=0x2ff22228, file=0x2ff22320) at google/ > > >> >>> protobuf/compiler/parser.cc:321 > > >> >>> #14 0xd1d4965c in > > > > >> > FindFileByName__Q4_6google8protobuf8compiler28SourceTreeDescriptorDatabaseFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc > > >> >>> (this=0x2ff22548, filena...@0x2000bce8, > > >> >>> output=0x2ff22320) at google/protobuf/compiler/importer.cc:145 > > >> >>> #15 0xd1b4a4f0 in > > > > >> > TryFindFileInFallbackDatabase__Q3_6google8protobuf14DescriptorPoolCFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0x2ff2256c, na...@0x2000bce8) > > >> >>> at google/protobuf/descriptor.cc:1230 > > >> >>> #16 0xd1b4a844 in > > > > >> > FindFileByName__Q3_6google8protobuf14DescriptorPoolCFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0x2ff2256c, na...@0x2000bce8) > > >> >>> at google/protobuf/descriptor.cc:875 > > >> >>> #17 0xd1d47ad4 in > > > > >> > Import__Q4_6google8protobuf8compiler8ImporterFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0x2ff22548, filena...@0x2000bce8) > > >> >>> at google/protobuf/compiler/importer.cc:194 > > >> >>> #18 0xd1757ea0 in > > >> >>> google::protobuf::compiler::CommandLineInterface::Run > > >> >>> (this=0x2ff22750, argc=3, argv=0x2ff228f0) at > > >> google/protobuf/compiler/ > > >> >>> command_line_interface.cc:352 > > >> >>> #19 0x10002894 in main (argc=3, argv=0x2ff228f0) at > google/protobuf/ > > >> >>> compiler/main.cc:59 > > >> >>> #20 0x100001ec in __start () > > >> >>> #0 0xd1afa384 in > > > > >> > __cl__Q3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__RCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__ > > >> >>> (this=0xf04ca4e0, a...@0xc, b...@0x2ff2222c) at > > > > ... > > > > read more ยป > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---