~zorba-coders/zorba/bug1024580

« back to all changes in this revision

Viewing changes to src/store/naive/item.cpp

  • Committer: Rodolfo Ochoa
  • Date: 2012-09-08 16:36:08 UTC
  • mfrom: (10937.1.51 zorba)
  • Revision ID: rodolfo.ochoa@gmail.com-20120908163608-mz55ayoa8lznh7i3
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
#include "runtime/function_item/function_item.h"
36
36
 
37
 
# include <cstdlib>
38
 
# include <execinfo.h>
39
 
 
40
37
 
41
38
namespace zorba
42
39
{
76
73
    SYNC_CODE(static_cast<const simplestore::json::JSONItem*>(this)->getRCLock()->acquire());
77
74
    ++theRefCount;
78
75
    SYNC_CODE(static_cast<const simplestore::json::JSONItem*>(this)->getRCLock()->release());
 
76
    return;
79
77
  }
80
78
#endif
81
79
  case ATOMIC:
164
162
    }
165
163
 
166
164
    SYNC_CODE(static_cast<const simplestore::json::JSONItem*>(this)->getRCLock()->release());
 
165
    return;
167
166
  }
168
167
#endif
169
168
  case ATOMIC:
495
494
}
496
495
 
497
496
 
498
 
static void print_stack_trace( std::ostream& o ) 
499
 
{
500
 
  int BUF_SIZE = 250;
501
 
  void* buf[ BUF_SIZE ];
502
 
 
503
 
  int const size = backtrace(buf, BUF_SIZE);
504
 
 
505
 
  if (char** symbols = backtrace_symbols(buf, size)) 
506
 
  {
507
 
    for ( int i = 0; i < size; ++i )
508
 
      o << symbols[i] << std::endl;
509
 
 
510
 
    free( symbols );
511
 
  }
512
 
  else
513
 
  {
514
 
    o << "allocation of backtrace symbols failed" << std::endl;
515
 
  }
516
 
}
517
 
 
518
 
 
519
497
/**
520
498
 * Accessor for xs:untypedAtomic and xs:string and its subtypes
521
499
 */
522
500
const zstring& Item::getString() const
523
501
{
524
 
  if (isAtomic())
525
 
  {
526
 
    std::cerr << "Atomic item value: " << getStringValue() << std::endl;
527
 
  }
528
 
  else if (isNode())
529
 
  {
530
 
    std::cerr << "Node item: " << this << std::endl
531
 
              << " node name: " << getNodeName()->getStringValue() << std::endl
532
 
              << " node string value: " << getStringValue() << std::endl;
533
 
  }
534
 
  else
535
 
  {
536
 
    std::cerr << "???????" << std::endl;
537
 
  }
538
 
 
539
 
  
540
 
  print_stack_trace(std::cerr);
541
 
 
542
502
  throw ZORBA_EXCEPTION(
543
503
    zerr::ZSTR0040_TYPE_ERROR,
544
504
    ERROR_PARAMS(