GCC C语言处理主要函数之dbxout_init

 

/* At the beginning of compilation, start writing the symbol table.    Initialize `typevec' and output the standard data types of C.  */

static void dbxout_init (const char *input_file_name) {   char ltext_label_name[100];   bool used_ltext_label_name = false;   tree syms = lang_hooks.decls.getdecls ();   const char *mapped_name;

  typevec_len = 100;   typevec = ggc_cleared_vec_alloc<typeinfo> (typevec_len);

  /* stabstr_ob contains one string, which will be just fine with      1-byte alignment.  */   obstack_specify_allocation (&stabstr_ob, 0, 1, xmalloc, free);

  /* Convert Ltext into the appropriate format for local labels in case      the system doesn't insert underscores in front of user generated      labels.  */   ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);

  /* Put the current working directory in an N_SO symbol.  */   if (use_gnu_debug_info_extensions && !NO_DBX_MAIN_SOURCE_DIRECTORY)     {       static const char *cwd;

      if (!cwd)  {    cwd = get_src_pwd ();    if (cwd[0] == '\0')      cwd = "/";    else if (!IS_DIR_SEPARATOR (cwd[strlen (cwd) - 1]))      cwd = concat (cwd, "/", NULL);    cwd = remap_debug_filename (cwd);  } #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY       DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asm_out_file, cwd); #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */       dbxout_begin_simple_stabs_desc (cwd, N_SO, get_lang_number ());       dbxout_stab_value_label (ltext_label_name);       used_ltext_label_name = true; #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */     }

  mapped_name = remap_debug_filename (input_file_name); #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME   DBX_OUTPUT_MAIN_SOURCE_FILENAME (asm_out_file, mapped_name); #else   dbxout_begin_simple_stabs_desc (mapped_name, N_SO, get_lang_number ());   dbxout_stab_value_label (ltext_label_name);   used_ltext_label_name = true; #endif

  if (used_ltext_label_name)     {       switch_to_section (text_section);       targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);     }

  /* Emit an N_OPT stab to indicate that this file was compiled by GCC.      The string used is historical.  */ #ifndef NO_DBX_GCC_MARKER   dbxout_begin_simple_stabs ("gcc2_compiled.", N_OPT);   dbxout_stab_value_zero (); #endif

  base_input_file = lastfile = input_file_name;

  next_type_number = 1;

#ifdef DBX_USE_BINCL   current_file = XNEW (struct dbx_file);   current_file->next = NULL;   current_file->file_number = 0;   current_file->next_type_number = 1;   next_file_number = 1;   current_file->prev = NULL;   current_file->bincl_status = BINCL_NOT_REQUIRED;   current_file->pending_bincl_name = NULL; #endif

  /* Get all permanent types that have typedef names, and output them      all, except for those already output.  Some language front ends      put these declarations in the top-level scope; some do not;      the latter are responsible for calling debug_hooks->type_decl from      their record_builtin_type function.  */   dbxout_typedefs (syms);

  if (preinit_symbols)     {       tree t;       for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t))  dbxout_symbol (TREE_VALUE (t), 0);       preinit_symbols = 0;     } }

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值