• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ demangle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中demangle函数的典型用法代码示例。如果您正苦于以下问题:C++ demangle函数的具体用法?C++ demangle怎么用?C++ demangle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了demangle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: str

void OneshotTracer::tick(std::map<pid_t, std::vector<Frame>> stacktraces) {
    for (const auto& kv: stacktraces) {
        std::cout << boost::format("Thread %d:\n") % kv.first;
        for (const auto& frame: kv.second) {
            std::cout << str(boost::format("0x%x %s\n") %
                        frame.ip %
                        abbrev(demangle(frame.procName)));
        }
        std::cout << std::endl;
    }
}
开发者ID:eeight,项目名称:wat,代码行数:11,代码来源:oneshot_tracer.cpp


示例2: type_string

const string_t type_string(const std::type_info& Info)
{
	detail::initialize_types();

	detail::type_to_name_map_t::iterator type = detail::type_to_name_map.find(detail::type_info(Info));
	if(type != detail::type_to_name_map.end())
		return type->second;

	log() << error << k3d_file_reference << ": unknown type: " << demangle(Info) << std::endl;
	return "";
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:11,代码来源:type_registry.cpp


示例3: demangle

std::string
Transient::getTimeStepperName()
{
  if (_time_stepper)
  {
    TimeStepper & ts = *_time_stepper;
    return demangle(typeid(ts).name());
  }
  else
    return std::string();
}
开发者ID:modulexcite,项目名称:moose,代码行数:11,代码来源:Transient.C


示例4: _ex_terminate

static void _ex_terminate()
{
    static bool already_tried = false;

    Log::setLogHandler(NULL);

    try
    {
        // try once to re-throw currently active exception
        if( !already_tried )
        {
        	already_tried = true;
        	throw;
        }
    }
    catch( const RuntimeError &e )
    {
    	e.Log();
    }
    catch (const std::exception &e)
    {
        do_log_msg( LOG_PRIORITY_ERROR, NULL, typeid(e).name(), e.what() );
    }
    catch (...) {
        do_log_msg( LOG_PRIORITY_ERROR, NULL, "Unknown", "Unknown exception" );
    }

	fprintf( stderr, "Unhandled exception, program terminated\n" );

#ifndef SMART_LOG_NO_BACKTRACE

	fprintf( stderr, "Backtrace:\n" );

    void* fnAddr[UTIL_LOG_BACKTRACE_SIZE];
    int size = backtrace(fnAddr, UTIL_LOG_BACKTRACE_SIZE);

    char** fnSyms = backtrace_symbols(fnAddr, size);

    if( fnSyms != NULL )
    {
		// We skip the first call in the stack, which is the call to this
    	// function
		for (int i=1; i < size; i++)
		{
		    fprintf( stderr,"[%d]: %s\n", i, demangle(fnSyms[i]).c_str() );
		}

		free(fnSyms);
    }

#endif // SMART_LOG_NO_BACKTRACE

    abort();
}
开发者ID:jgonzalezdr,项目名称:smartlib,代码行数:54,代码来源:Log.cpp


示例5: main

int main() {
  struct {
    const char* raw;
    const char* expect;
  } TestCases[] = {
      {typeid(int).name(), "i"}, // FIXME
      {typeid(MyType).name(), "MyType"},
      {typeid(ArgumentListID<int, MyType>).name(), "ArgumentListID<int, MyType>"}
  };
  const size_t size = sizeof(TestCases) / sizeof(TestCases[0]);
  for (size_t i=0; i < size; ++i) {
    const char* raw = TestCases[i].raw;
    const char* expect = TestCases[i].expect;
#ifdef TEST_HAS_NO_DEMANGLE
    assert(demangle(raw) == raw);
#else
    assert(demangle(raw) == expect);
#endif
  }
}
开发者ID:kraj,项目名称:libcxx,代码行数:20,代码来源:test_demangle.pass.cpp


示例6: splitFilePath

void FSEventsService::rename(std::vector<std::string> *paths) {
  auto *binNamesByPath = new std::map<std::string, std::vector<std::string> *>;

  for (auto pathIterator = paths->begin(); pathIterator != paths->end(); ++pathIterator) {
    std::string directory, name;
    splitFilePath(directory, name, *pathIterator);
    if (binNamesByPath->find(directory) == binNamesByPath->end()) {
      (*binNamesByPath)[directory] = new std::vector<std::string>;
    }
    (*binNamesByPath)[directory]->push_back(name);
  }

  for (auto binIterator = binNamesByPath->begin(); binIterator != binNamesByPath->end(); ++binIterator) {
    if (binIterator->second->size() == 2) {
      std::string sideA = (*binIterator->second)[0],
                  sideB = (*binIterator->second)[1];
      std::string fullSideA = binIterator->first + "/" + sideA,
                  fullSideB = binIterator->first + "/" + sideB;
      struct stat renameSideA, renameSideB;
      bool sideAExists = stat(fullSideA.c_str(), &renameSideA) == 0,
           sideBExists = stat(fullSideB.c_str(), &renameSideB) == 0;

      if (sideAExists && !sideBExists) {
        mQueue.enqueue(RENAMED, binIterator->first, sideB, sideA);
      } else if (!sideAExists && sideBExists) {
        mQueue.enqueue(RENAMED, binIterator->first, sideA, sideB);
      } else {
        demangle(fullSideA);
        demangle(fullSideB);
      }

    } else {
      for (auto pathIterator = binIterator->second->begin(); pathIterator != binIterator->second->end(); ++pathIterator) {
        demangle(binIterator->first + "/" + *pathIterator);
      }
    }
    delete binIterator->second;
    binIterator->second = NULL;
  }
  delete binNamesByPath;
}
开发者ID:Axosoft,项目名称:nsfw,代码行数:41,代码来源:FSEventsService.cpp


示例7: main

int main(int argc, char **argv) {
#if defined(__CYGWIN__)
  // Cygwin clang 3.5.2 with '-O3' generates CRASHING BINARY,
  // if main()'s first function call is passing argv[0].
  std::rand();
#endif  
  llvm::cl::ParseCommandLineOptions(argc, argv);

  swift::Demangle::DemangleOptions options;
  options.SynthesizeSugarOnTypes = !DisableSugar;
  if (Simplified)
    options = swift::Demangle::DemangleOptions::SimplifiedUIDemangleOptions();

  if (InputNames.empty()) {
    CompactMode = true;
    auto input = llvm::MemoryBuffer::getSTDIN();
    if (!input) {
      llvm::errs() << input.getError().message() << '\n';
      return EXIT_FAILURE;
    }
    llvm::StringRef inputContents = input.get()->getBuffer();

    // This doesn't handle Unicode symbols, but maybe that's okay.
    llvm::Regex maybeSymbol("_T[_a-zA-Z0-9$]+");
    llvm::SmallVector<llvm::StringRef, 1> matches;
    while (maybeSymbol.match(inputContents, &matches)) {
      llvm::outs() << substrBefore(inputContents, matches.front());
      demangle(llvm::outs(), matches.front(), options);
      inputContents = substrAfter(inputContents, matches.front());
    }
    llvm::outs() << inputContents;

  } else {
    for (llvm::StringRef name : InputNames) {
      demangle(llvm::outs(), name, options);
      llvm::outs() << '\n';
    }
  }

  return EXIT_SUCCESS;
}
开发者ID:007Indian,项目名称:swift,代码行数:41,代码来源:swift-demangle.cpp


示例8: print_sym

static int print_sym(void *user_data, const char *name, address_t value)
{
	(void)user_data;

	char demangled[MAX_SYMBOL_LENGTH];
	if (demangle(name, demangled, sizeof(demangled)) > 0)
		printc("0x%04x: %s (%s)\n", value, name, demangled);
	else
		printc("0x%04x: %s\n", value, name);

	return 0;
}
开发者ID:Batov,项目名称:libusb_chrome_api,代码行数:12,代码来源:sym.c


示例9: main

	void main() {
		#if 0
			// Utilisation incorrecte avec zéro argument
			std::cout << max() << std::endl;
			// => Ne compile pas : error: static_assert failed "max needs at least 1 argument"
		#endif

		#if 0
			// Utilisation incorrecte avec zéro argument (bypasse le point d'entrée et appel direct de l'implantation max_impl)
			std::cout << max_impl() << std::endl;
			// => Ne compile pas : error: no matching function for call to 'max_impl'
		#endif

		std::cout << max(2) << std::endl;
		// => Affiche "2"

		std::cout << max(2, 1) << std::endl;
		// => Affiche "2"

		std::cout << max(2, 1, 6) << std::endl;
		// => Affiche "6"

		// Fonctionne avec tout type qui implante l'opérateur >
		std::string s1{"def"}, s2{"abc"};
		std::cout << max(s1, s2) << std::endl;
		// => Affiche "def"

		// Attention tout de même! l'opérateur > ici compare les adresses
		std::cout << max(s1.c_str(), s2.c_str()) << std::endl;
		// => Affiche "abc" sur ma machine

		// Attention tout de même! l'opérateur > ici compare les adresses
		char a1[]{"abc"}, a2[]{"def"}, a3[]{"abc"};
		std::cout << max(a1, a2) << std::endl;
		// => Affiche "abc" sur ma machine
		std::cout << max(a2, a3) << std::endl;
		// => Affiche "def" sur ma machine

		// Fonctionne très bien avec des types hétérogènes
		std::cout << max(2, 1.0, 6.0f, 4ull) << std::endl;
		// => Affiche "6"

		// Voyons quel est le type du résultat ...
		auto result = max(2, 1.0, 6.0f, 4ull);
		std::cout << demangle(typeid(result).name()) << std::endl;
		// => Affiche "double"

		#if 0
			// Vérification statique (à la compilation) que les types sont compatibles
			std::cout << max(s1, 123) << std::endl;
			// => Ne compile pas : error: invalid operands to binary expression ('std::basic_string<char>' and 'int')
		#endif
	}
开发者ID:NantesCppMeetup,项目名称:NCM,代码行数:53,代码来源:max_variadic_template.hpp


示例10: exception_to_r_condition

SEXP exception_to_r_condition( const std::exception& ex){
    std::string ex_class = demangle( typeid(ex).name() ) ;
    std::string ex_msg   = ex.what() ; 
    
    SEXP cppstack = PROTECT( rcpp_get_stack_trace() ) ;
    SEXP call = PROTECT( get_last_call() ) ;
    SEXP classes = PROTECT( get_exception_classes(ex_class) ) ;
    SEXP condition = PROTECT( make_condition( ex_msg, call, cppstack, classes ) ) ; 
    rcpp_set_stack_trace( R_NilValue ) ;
    UNPROTECT(4) ;
    return condition ;
}
开发者ID:jjallaire,项目名称:Rcpp,代码行数:12,代码来源:exceptions.cpp


示例11: __type_of

    std::string __type_of(typename std::remove_reference<Tp>::type &)
    {
        auto name = demangle(typeid(Tp).name());
        if (std::is_const<
             typename std::remove_reference<Tp>::type>::value)
            name.append(" const");

        if (std::is_volatile<
             typename std::remove_reference<Tp>::type>::value)
            name.append(" volatile");

        return name.append("&");
    }
开发者ID:awgn,项目名称:codes,代码行数:13,代码来源:cxxabi.hpp


示例12: printf

    template <class T> inline Matrix<T>&
	Get              (const std::string& name) {

		reflist::iterator it = m_ref.find(name);

        if (it == m_ref.end())
            printf ("**WARNING**: Matrix %s could not be found in workspace!\n", name.c_str());

        const boost::any& ba = m_store[it->second[0]];

        try {
			boost::any_cast<boost::shared_ptr<Matrix<T> > >(m_store[it->second[0]]);
		} catch (const boost::bad_any_cast& e) {
			printf ("**WARNING**: Failed to retrieve %s - %s.\n             Requested %s - have %s.\n",
					name.c_str(), e.what(),
                    demangle(typeid(boost::shared_ptr<Matrix<T> >).name()).c_str(),
                    demangle(ba.type().name()).c_str());
		}

		return *boost::any_cast<boost::shared_ptr<Matrix<T> > >(m_store[it->second[0]]);

	}
开发者ID:nomissretep,项目名称:codeare,代码行数:22,代码来源:Workspace.hpp


示例13: getRegistryMap

stk::diag::Writer &
Registry::verbose_print(
  stk::diag::Writer &		dout) const
{
  if (dout.shouldPrint()) {
    dout << "Registry, size " << getRegistryMap().size() << stk::diag::push << stk::diag::dendl;

    for (RegistryMap::const_iterator it = getRegistryMap().begin(); it != getRegistryMap().end(); ++it)
      dout << (*it).first.second << " of type " << demangle((*it).first.first->name()) << " at " << (*it).second << stk::diag::dendl;
    dout << stk::diag::pop;
  }
  return dout;
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:13,代码来源:UserPlugin.cpp


示例14: print_backtrace

void print_backtrace(char const* label)
{
	void* stack[50];
	int size = backtrace(stack, 50);
	char** symbols = backtrace_symbols(stack, size);

	fprintf(stderr, "%s\n", label);
	for (int i = 1; i < size; ++i)
	{
		fprintf(stderr, "%d: %s\n", i, demangle(symbols[i]).c_str());
	}

	free(symbols);
}
开发者ID:BlackYoup,项目名称:medusa,代码行数:14,代码来源:assert.cpp


示例15: metatype

	Metatype &
	metatype( const std::string& pname ) {
		std::string name = pname;
#ifdef __BORLANDC__
		if ( name[name.length()-1]=='&' ) {
			name = name.substr( 0, name.length()-2 );
		}
#endif
		TypeMap::iterator it = _meta_types.find( name );
		if ( it == _meta_types.end() ) {
			throw Error( "Metatype '" + demangle( name ) + "' not declared" );
		}
		return *it->second;
	}
开发者ID:fast01,项目名称:jrtti,代码行数:14,代码来源:reflector.hpp


示例16: MgwUnDecorateSymbolName

DWORD WINAPI
MgwUnDecorateSymbolName(PCSTR DecoratedName, PSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags)
{
    assert(DecoratedName != NULL);

    char *output_buffer = demangle(DecoratedName, Flags);
    if (output_buffer) {
        strncpy(UnDecoratedName, output_buffer, UndecoratedLength);
        free(output_buffer);
        return strlen(UnDecoratedName);
    }

    return UnDecorateSymbolName(DecoratedName, UnDecoratedName, UndecoratedLength, Flags);
}
开发者ID:aijiekj,项目名称:drmingw,代码行数:14,代码来源:mgwhelp.c


示例17: mpiPdemangle

char *
mpiPdemangle (const char *mangledSym)
{
  Name *ret;
  char *rest;
  unsigned long opts = 0x1;

  ret = demangle ((char *) mangledSym, &rest, opts);

  if (ret != NULL)
    return strdup (text (ret));
  else
    return NULL;
}
开发者ID:mnsekh111,项目名称:AWS_Parallel-Systems,代码行数:14,代码来源:pc_lookup.c


示例18: show_imageinfo

/**
 * \brief Common image info display function
 */
int	show_imageinfo(ImagePtr image) {
	if (fitsinfo) {
		std::cout << *image;
	}

	if (verbose) {
		std::cout << "bpp=" << image->bitsPerPixel();
		std::cout << " Bpp=" << image->bytesPerPixel();
		std::cout << " planes=" << image->planes();
		std::cout << " minvalue=" << image->minimum();
		std::cout << " maxvalue=" << image->maximum();
		std::cout << " pixel_type=";
		std::cout << demangle(image->pixel_type().name());
		std::cout << " ";
	}

	// find maximum, minimum, average and median values
	double	maximum = astro::image::filter::max(image);
	double	minimum = astro::image::filter::min(image);
	double	mean = astro::image::filter::mean(image);
	double	median = astro::image::filter::median(image);
	double	nans = -1;
	try {
		nans = astro::image::filter::countnans(image);
	} catch (...) {
		debug(LOG_DEBUG, DEBUG_LOG, 0, "ignoring nans");
	}
	
	std::cout << "min=" << minimum;
	if (median < mean) {
		std::cout << " median=" << median;
		std::cout << " mean=" << mean;
	} else {
		std::cout << " mean=" << mean;
		std::cout << " median=" << median;
	}
	std::cout << " max=" << maximum;
	if (nans >= 0) {
		std::cout << " nans=" << nans;
	}
	if (image->getMosaicType() != MosaicType()) {
		RGB<double>	meancolor
			= astro::image::filter::mean_color(image);
		std::cout << " red=" << meancolor.R;
		std::cout << " green=" << meancolor.G;
		std::cout << " blue=" << meancolor.B;
	}

	return EXIT_SUCCESS;
}
开发者ID:AndreasFMueller,项目名称:AstroPhotography,代码行数:53,代码来源:imageinfo.cpp


示例19: backtrace_symbols

std::string StackTrace::toString() const
{
    char ** symbols = backtrace_symbols(frames, frames_size);
    std::stringstream res;

    if (!symbols)
        return "Cannot get symbols for stack trace.\n";

    try
    {
        for (size_t i = 0, size = frames_size; i < size; ++i)
        {
            /// We do "demangling" of names. The name is in parenthesis, before the '+' character.

            char * name_start = nullptr;
            char * name_end = nullptr;
            std::string demangled_name;
            int status = 0;

            if (nullptr != (name_start = strchr(symbols[i], '('))
                && nullptr != (name_end = strchr(name_start, '+')))
            {
                ++name_start;
                *name_end = '\0';
                demangled_name = demangle(name_start, status);
                *name_end = '+';
            }

            res << i << ". ";

            if (0 == status && name_start && name_end)
            {
                res.write(symbols[i], name_start - symbols[i]);
                res << demangled_name << name_end;
            }
            else
                res << symbols[i];

            res << std::endl;
        }
    }
    catch (...)
    {
        free(symbols);
        throw;
    }

    free(symbols);
    return res.str();
}
开发者ID:kellylg,项目名称:ClickHouse,代码行数:50,代码来源:StackTrace.cpp


示例20: cref_fill_array

static bfd_boolean
cref_fill_array (struct cref_hash_entry *h, void *data)
{
  struct cref_hash_entry ***pph = data;

  ASSERT (h->demangled == NULL);
  h->demangled = demangle (h->root.string);

  **pph = h;

  ++*pph;

  return TRUE;
}
开发者ID:DmitrySkiba,项目名称:itoa-toolchain,代码行数:14,代码来源:ldcref.c



注:本文中的demangle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ demo函数代码示例发布时间:2022-05-30
下一篇:
C++ demand_empty_rest_of_line函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap