00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "dwarf_DST_producer.h"
00041 #include "errors.h"
00042 #ifdef KEY
00043 #include <ctype.h>
00044 #endif
00045
00046
00047
00048
00049
00050
00051 #define DST_ASSERT(truth, msg) Is_True(truth, (msg))
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 typedef enum DST_producer_state
00062 {
00063 DST_begin_state,
00064 DST_making_include_dirs,
00065 DST_making_file_names,
00066 DST_making_macinfo,
00067 DST_making_dbg_info,
00068 DST_end_state
00069 } DST_PRODUCER_STATE;
00070
00071 static DST_PRODUCER_STATE pstate = DST_begin_state;
00072 static DST_DIR_IDX last_include_dir = DST_INVALID_INIT;
00073 static DST_FILE_IDX last_file_name = DST_INVALID_INIT;
00074 static DST_INFO_IDX last_info_idx = DST_INVALID_INIT;
00075 static DST_INFO_IDX file_scope_info = DST_INVALID_INIT;
00076 static DST_INFO_IDX forced_exit_info = DST_INVALID_INIT;
00077 #ifdef KEY
00078 static DST_MACR_IDX last_macro = DST_INVALID_INIT;
00079 #endif
00080
00081 static mUINT16 num_file_names = 0;
00082 static mUINT16 num_incl_dirs = 0;
00083 #ifdef KEY
00084 static mUINT16 num_macros = 0;
00085 #endif
00086
00087 static BOOL begin_PU = FALSE;
00088 static mINT32 file_scope_locks = 0;
00089
00090
00091
00092
00093
00094
00095 #define DST_64_allign 8
00096 #define DST_32_align 4
00097 #define DST_char_align 1
00098 #define DST_default_align DST_64_allign
00099
00100
00101
00102
00103 #define DST_mk(type) DST_allocate(sizeof(type), DST_default_align)
00104
00105 #define DST_mk_file() (DST_mk(DST_FILE_NAME));
00106 #define DST_mk_dir() (DST_mk(DST_INCLUDE_DIR));
00107 #define DST_mk_info() (DST_mk(DST_INFO));
00108 #define DST_mk_attr(type) (DST_mk(type));
00109 #ifdef KEY
00110 #define DST_mk_macro() (DST_mk(DST_MACR));
00111 #endif
00112
00113 #if defined(MONGOOSE_BE)
00114
00115
00116 #define DST_enter_mk(a, b)
00117 #endif
00118
00119 DST_STR_IDX
00120 DST_mk_string(const char *s)
00121 {
00122 DST_STR_IDX str_idx;
00123
00124 if (s!=NULL)
00125 {
00126 str_idx = DST_allocate(strlen(s) + 1, DST_char_align);
00127 (void)strcpy(DST_STR_IDX_TO_PTR(str_idx), s);
00128 }
00129 else
00130 str_idx = DST_INVALID_IDX;
00131
00132 return str_idx;
00133 }
00134
00135
00136 static DST_STR_IDX
00137 DST_mk_name(const char *s)
00138 {
00139 DST_STR_IDX str_idx;
00140
00141
00142
00143
00144 #ifndef KEY
00145 if ((s != NULL) && (*s != '\0'))
00146 #else
00147
00148
00149
00150 if ((s != NULL) && (*s != '\0') &&
00151 !(*s == '.' && s[1] == '_' && isdigit(s[2])))
00152 #endif
00153 {
00154 str_idx = DST_allocate(strlen(s) + 1, DST_char_align);
00155 (void)strcpy(DST_STR_IDX_TO_PTR(str_idx), s);
00156 }
00157 else
00158 str_idx = DST_INVALID_IDX;
00159
00160 return str_idx;
00161 }
00162
00163
00164 #if (!defined(MONGOOSE_BE))
00165
00166
00167
00168
00169
00170
00171 static void
00172 DST_enter_mk(DST_PRODUCER_STATE new_state, DST_IDX last_idx)
00173 {
00174 if (file_scope_locks && new_state==DST_making_dbg_info)
00175 {
00176
00177 if (pstate != new_state)
00178 {
00179 DST_return_to_block(last_idx);
00180 pstate = new_state;
00181 }
00182 if (!DST_IS_NULL(file_scope_info) && DST_IS_NULL(forced_exit_info))
00183 {
00184 forced_exit_info = last_info_idx;
00185 DST_return_to_block(file_scope_info);
00186 }
00187 }
00188 else if (begin_PU && new_state==DST_making_dbg_info)
00189 {
00190
00191 DST_ASSERT(!DST_IS_NULL(file_scope_info), "Premature entry into PU");
00192 DST_begin_block(DST_local_scope_block);
00193 pstate = new_state;
00194 begin_PU = FALSE;
00195 }
00196 else if (pstate != new_state)
00197 {
00198 DST_return_to_block(last_idx);
00199 pstate = new_state;
00200 }
00201 }
00202 #endif
00203
00204 #define DST_check_info_idx(required_tag, idx)\
00205 DST_ASSERT((DST_IS_FOREIGN_OBJ(idx)) || (DST_INFO_tag(DST_INFO_IDX_TO_PTR(idx)) == required_tag),\
00206 "Found invalid DST_info index")
00207
00208 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER)
00209
00210
00211
00212 static void
00213 DST_set_last_file_name(void)
00214 {
00215 DST_IDX idx;
00216 num_file_names = 0;
00217 for (idx = DST_get_file_names (); !DST_IS_NULL(idx); idx = DST_FILE_NAME_next(DST_FILE_IDX_TO_PTR(idx))) {
00218 num_file_names++;
00219 last_file_name = idx;
00220 }
00221 }
00222
00223 static void
00224 DST_set_last_include_dir(void)
00225 {
00226 DST_IDX idx;
00227 num_incl_dirs = 0;
00228 for (idx = DST_get_include_dirs (); !DST_IS_NULL(idx); idx = DST_INCLUDE_DIR_next(DST_DIR_IDX_TO_PTR(idx))) {
00229 num_incl_dirs++;
00230 last_include_dir = idx;
00231 }
00232 }
00233
00234 #endif
00235
00236
00237
00238
00239
00240
00241
00242
00243 DST_IDX
00244 DST_mk_include_dir(char *path)
00245 {
00246 DST_INCLUDE_DIR *dir_ptr, *prev_ptr;
00247 DST_DIR_IDX dir_idx;
00248
00249
00250 if (DST_IS_NULL(last_include_dir))
00251 {
00252 DST_begin_block(DST_include_dirs_block);
00253
00254 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00255 pstate = DST_making_include_dirs;
00256 #endif
00257 }
00258 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00259 else
00260 DST_enter_mk(DST_making_include_dirs, last_include_dir);
00261 #endif
00262
00263
00264 dir_idx = DST_mk_dir();
00265 dir_ptr = DST_DIR_IDX_TO_PTR(dir_idx);
00266 DST_INCLUDE_DIR_path(dir_ptr) = DST_mk_string(path);
00267 DST_INCLUDE_DIR_next(dir_ptr) = DST_INVALID_IDX;
00268 if (!DST_IS_NULL(last_include_dir))
00269 {
00270 prev_ptr = DST_DIR_IDX_TO_PTR(last_include_dir);
00271 DST_INCLUDE_DIR_next(prev_ptr) = dir_idx;
00272 }
00273 last_include_dir = dir_idx;
00274 num_incl_dirs += 1;
00275 return dir_idx;
00276 }
00277
00278
00279 mUINT16
00280 DST_number_of_include_dirs(void)
00281 {
00282 return num_incl_dirs;
00283 }
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 DST_IDX
00298 DST_mk_file_name(char *file_name,
00299 mUINT16 incl_dir,
00300 UINT64 size,
00301 UINT64 modt)
00302 {
00303 DST_FILE_NAME *f_ptr, *prev_ptr;
00304 DST_FILE_IDX f_idx;
00305
00306
00307 if (DST_IS_NULL(last_file_name))
00308 {
00309 DST_begin_block(DST_file_names_block);
00310 pstate = DST_making_file_names;
00311 }
00312 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00313 else
00314 DST_enter_mk(DST_making_file_names, last_file_name);
00315 #endif
00316
00317
00318 f_idx = DST_mk_file();
00319 f_ptr = DST_FILE_IDX_TO_PTR(f_idx);
00320 DST_FILE_NAME_name(f_ptr) = DST_mk_string(file_name);
00321 DST_FILE_NAME_dir(f_ptr) = incl_dir;
00322 DST_FILE_NAME_size(f_ptr) = size;
00323 DST_FILE_NAME_modt(f_ptr) = modt;
00324 DST_FILE_NAME_next(f_ptr) = DST_INVALID_IDX;
00325 if (!DST_IS_NULL(last_file_name))
00326 {
00327 prev_ptr = DST_FILE_IDX_TO_PTR(last_file_name);
00328 DST_FILE_NAME_next(prev_ptr) = f_idx;
00329 }
00330 last_file_name = f_idx;
00331 num_file_names += 1;
00332 return f_idx;
00333 }
00334
00335
00336 mUINT16
00337 DST_number_of_files(void)
00338 {
00339 return num_file_names;
00340 }
00341
00342 #ifdef KEY
00343 mUINT16
00344 DST_number_of_macros(void)
00345 {
00346 return num_macros;
00347 }
00348 #endif
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367 void DST_lock_to_file_scope_mem(void)
00368 {
00369 DST_ASSERT(file_scope_locks >= 0, "Erroneous state for file-scope lock");
00370 file_scope_locks += 1;
00371 }
00372
00373 void DST_release_from_file_scope_mem(void)
00374 {
00375 DST_ASSERT(file_scope_locks > 0, "Missing lock for file-scope release");
00376 file_scope_locks -= 1;
00377 if (!file_scope_locks && !DST_IS_NULL(forced_exit_info))
00378 {
00379 last_info_idx = forced_exit_info;
00380 forced_exit_info = DST_INVALID_IDX;
00381 if (pstate == DST_making_dbg_info)
00382 DST_return_to_block(last_info_idx);
00383 }
00384 }
00385
00386 mINT32 DST_unwind_locks(void)
00387 {
00388 mINT32 number_of_locks = file_scope_locks;
00389
00390 file_scope_locks = 1;
00391 DST_release_from_file_scope_mem();
00392 return number_of_locks;
00393 }
00394
00395 extern void DST_wind_up_locks(mINT32 number_of_locks)
00396 {
00397 file_scope_locks += number_of_locks;
00398 }
00399
00400 BOOL DST_is_locked_to_file_scope_mem(void)
00401 {
00402 return file_scope_locks > 0;
00403 }
00404
00405
00406
00407
00408
00409 static DST_INFO_IDX
00410 DST_init_info(DST_INFO_IDX info_idx,
00411 DST_DW_tag tag,
00412 DST_flag flag,
00413 DST_ATTR_IDX attrs)
00414 {
00415 DST_INFO *info_ptr;
00416
00417 info_ptr = DST_INFO_IDX_TO_PTR(info_idx);
00418 DST_INFO_tag(info_ptr) = tag;
00419 DST_INFO_flag(info_ptr) = flag;
00420 DST_INFO_sibling(info_ptr) = DST_INVALID_IDX;
00421 DST_INFO_attributes(info_ptr) = attrs;
00422 DST_INFO_dieptr(info_ptr) = NULL;
00423 last_info_idx = attrs;
00424 return info_idx;
00425 }
00426
00427
00428
00429
00430
00431 DST_INFO_IDX
00432 DST_mk_compile_unit(char *src_path,
00433 char *comp_dir,
00434 char *comp_info,
00435 DST_language language,
00436 DST_identifier_case id_case)
00437 {
00438 DST_INFO_IDX info_idx;
00439 DST_ATTR_IDX cu_idx;
00440 DST_COMPILE_UNIT *cu;
00441
00442
00443 DST_ASSERT(DST_IS_NULL(last_info_idx),
00444 "Illegal attempt to start DST file-scope twice");
00445 pstate = DST_making_dbg_info;
00446
00447
00448 DST_begin_block(DST_file_scope_block);
00449 info_idx = DST_mk_info();
00450 cu_idx = DST_mk_attr(DST_COMPILE_UNIT);
00451 cu = DST_ATTR_IDX_TO_PTR(cu_idx, DST_COMPILE_UNIT);
00452 DST_COMPILE_UNIT_name(cu) = DST_mk_string(src_path);
00453 DST_COMPILE_UNIT_comp_dir(cu) = DST_mk_string(comp_dir);
00454 DST_COMPILE_UNIT_producer(cu) = DST_mk_string(comp_info);
00455 DST_COMPILE_UNIT_language(cu) = language;
00456 DST_COMPILE_UNIT_identifier_case(cu) = id_case;
00457 DST_COMPILE_UNIT_first_child(cu) = DST_INVALID_IDX;
00458 DST_COMPILE_UNIT_last_child(cu) = DST_INVALID_IDX;
00459
00460 return DST_init_info(info_idx, DW_TAG_compile_unit, DST_no_flag, cu_idx);
00461 }
00462
00463
00464
00465
00466
00467
00468
00469
00470 void
00471 DST_begin_PU(void)
00472 {
00473 DST_ASSERT(!file_scope_locks && DST_IS_NULL(file_scope_info) && !begin_PU,
00474 "Attempt to nest PU");
00475 begin_PU = TRUE;
00476 file_scope_info = last_info_idx;
00477 }
00478
00479
00480
00481
00482
00483 void
00484 DST_end_PU(void)
00485 {
00486 DST_ASSERT(!file_scope_locks && !DST_IS_NULL(file_scope_info) || begin_PU,
00487 "Premature attempt to end DST PU");
00488
00489 last_info_idx = file_scope_info;
00490 file_scope_info = DST_INVALID_IDX;
00491 if (begin_PU)
00492 begin_PU = FALSE;
00493 else
00494 {
00495 pstate = DST_making_dbg_info;
00496 DST_return_to_block(last_info_idx);
00497 }
00498 }
00499
00500
00501
00502
00503 DST_INFO_IDX
00504 DST_mk_inlined_subroutine(ST_IDX low_pc,
00505 ST_IDX high_pc,
00506 DST_INFO_IDX abstract_origin)
00507 {
00508 DST_INFO_IDX info_idx;
00509 DST_ATTR_IDX attr_idx;
00510 DST_flag flag = DST_no_flag;
00511 DST_INLINED_SUBROUTINE *attr;
00512
00513
00514 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00515 DST_enter_mk(DST_making_dbg_info, last_info_idx);
00516 #endif
00517 DST_check_info_idx(DW_TAG_subprogram, abstract_origin);
00518
00519 info_idx = DST_mk_info();
00520 attr_idx = DST_mk_attr(DST_INLINED_SUBROUTINE);
00521 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_INLINED_SUBROUTINE);
00522
00523 DST_ASSOC_INFO_st_idx(DST_INLINED_SUBROUTINE_low_pc (attr)) = low_pc;
00524 DST_ASSOC_INFO_st_idx(DST_INLINED_SUBROUTINE_high_pc(attr)) = high_pc;
00525 DST_INLINED_SUBROUTINE_abstract_origin(attr) = abstract_origin;
00526 DST_INLINED_SUBROUTINE_first_child(attr) = DST_INVALID_IDX;
00527 DST_INLINED_SUBROUTINE_last_child(attr) = DST_INVALID_IDX;
00528
00529 return DST_init_info(info_idx, DW_TAG_inlined_subroutine,
00530 flag, attr_idx);
00531 }
00532
00533
00534 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER)
00535
00536
00537 void
00538 DST_label_add_name(DST_LABEL *attr, char *label_name)
00539 {
00540 DST_LABEL_name(attr) = DST_mk_name(label_name);
00541 }
00542
00543 void
00544 DST_lexical_block_add_name(DST_LEXICAL_BLOCK *attr, char *block_name)
00545 {
00546 DST_LEXICAL_BLOCK_name(attr) = DST_mk_name(block_name);
00547 }
00548
00549
00550
00551
00552
00553 static mUINT16
00554 DST_get_ordinal_num(DST_DIR_IDX dir_idx, char *dir_name)
00555 {
00556 DST_DIR_IDX idx = dir_idx;
00557 mUINT16 num = 0;
00558 DST_INCLUDE_DIR *dir;
00559
00560 if (DST_IS_NULL(idx))
00561 return 0;
00562
00563 dir = DST_DIR_IDX_TO_PTR(idx);
00564
00565 while (dir != NULL) {
00566 num += 1;
00567 if (strcmp(DST_STR_IDX_TO_PTR(DST_INCLUDE_DIR_path(dir)), dir_name) == 0)
00568 return num;
00569 else {
00570 idx = DST_INCLUDE_DIR_next(dir);
00571 if (!DST_IS_NULL(idx))
00572 dir = DST_DIR_IDX_TO_PTR(idx);
00573 else
00574 dir = NULL;
00575 }
00576 }
00577
00578 if (dir == NULL) {
00579 (void)DST_mk_include_dir(dir_name);
00580 return num_incl_dirs;
00581 }
00582 return 0;
00583 }
00584
00585
00586 static char *
00587 DST_get_dirname(mUINT16 ordinal)
00588 {
00589 DST_DIR_IDX d_idx = DST_get_include_dirs();
00590 DST_INCLUDE_DIR *dir;
00591 mUINT16 i;
00592
00593 for (i = 0; i < ordinal; i++) {
00594 dir = DST_DIR_IDX_TO_PTR(d_idx);
00595 d_idx = DST_INCLUDE_DIR_next(dir);
00596 }
00597 return (DST_STR_IDX_TO_PTR(DST_INCLUDE_DIR_path(dir)));
00598 }
00599
00600
00601 char *
00602 DST_get_file(mUINT16 ordinal, UINT64 *file_size, UINT64 *fmod_time, char **dirname)
00603 {
00604 DST_FILE_IDX f_idx = DST_get_file_names();
00605 DST_FILE_NAME *file;
00606 mUINT16 i;
00607
00608
00609 if (ordinal == 0)
00610 return NULL;
00611
00612 for (i = 0; i < ordinal; i++) {
00613 file = DST_FILE_IDX_TO_PTR(f_idx);
00614 f_idx = DST_FILE_NAME_next(file);
00615 }
00616 *file_size = DST_FILE_NAME_size(file);
00617 *fmod_time = DST_FILE_NAME_modt(file);
00618 *dirname = DST_get_dirname(DST_FILE_NAME_dir(file));
00619 return (DST_STR_IDX_TO_PTR(DST_FILE_NAME_name(file)));
00620 }
00621
00622
00623
00624
00625 static mUINT16
00626 DST_get_file_id(char *filename, char *dirname, UINT64 file_size, UINT64 fmod_time)
00627 {
00628 DST_FILE_IDX f_idx = DST_get_file_names();
00629 DST_FILE_NAME *f_ptr;
00630 mUINT16 num = 0;
00631
00632
00633 while (!DST_IS_NULL(f_idx)) {
00634 f_ptr = DST_FILE_IDX_TO_PTR(f_idx);
00635 num += 1;
00636 if ((DST_FILE_NAME_size(f_ptr) == file_size) &&
00637 (DST_FILE_NAME_modt(f_ptr) == fmod_time) &&
00638 (strcmp(filename, DST_STR_IDX_TO_PTR(DST_FILE_NAME_name(f_ptr))) == 0) &&
00639 (strcmp(dirname, DST_get_dirname(DST_FILE_NAME_dir(f_ptr))) == 0)) {
00640
00641 return num;
00642 }
00643 f_idx = DST_FILE_NAME_next(f_ptr);
00644 }
00645 return 0;
00646 }
00647
00648
00649
00650
00651 static mUINT16
00652 DST_enter_file(char *filename, char *dirname, UINT64 file_size, UINT64 fmod_time)
00653 {
00654 DST_mk_file_name(filename, DST_get_ordinal_num(DST_get_include_dirs(),
00655 dirname),
00656 file_size,
00657 fmod_time);
00658
00659 return (num_file_names);
00660 }
00661
00662
00663 mUINT16
00664 DST_get_cross_inlined_file_id
00665 (char *filename,
00666 char *dirname,
00667 UINT64 file_size,
00668 UINT64 fmod_time)
00669
00670 {
00671 mUINT16 file_id = 0;
00672
00673
00674
00675 DST_set_last_include_dir();
00676 DST_set_last_file_name();
00677
00678 file_id = DST_get_file_id(filename, dirname, file_size, fmod_time);
00679 if (file_id == 0) {
00680 return(DST_enter_file(filename, dirname, file_size, fmod_time));
00681 }
00682 return file_id;
00683 }
00684
00685
00686 DST_INFO_IDX
00687 DST_mk_cross_inlined_subroutine(
00688 ST_IDX low_pc,
00689 ST_IDX high_pc,
00690 char *name,
00691
00692 mUINT16 *file_index,
00693 UINT64 file_size,
00694 UINT64 fmod_time,
00695 USRCPOS inl_decl,
00696 char *filename,
00697 char *dirname)
00698
00699 {
00700 DST_INFO_IDX info_idx;
00701 DST_ATTR_IDX attr_idx;
00702 DST_flag flag = DST_no_flag;
00703 DST_INLINED_SUBROUTINE *attr;
00704 USRCPOS decl;
00705 DST_INFO_IDX abstract_origin = DST_FOREIGN_INIT;
00706 mUINT16 file_id = 0;
00707
00708 USRCPOS_clear(decl);
00709 USRCPOS_column(decl) = USRCPOS_column(inl_decl);
00710 USRCPOS_linenum(decl) = USRCPOS_linenum(inl_decl);
00711 info_idx = DST_mk_info();
00712 attr_idx = DST_mk_attr(DST_INLINED_SUBROUTINE);
00713 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_INLINED_SUBROUTINE);
00714
00715 DST_set_last_include_dir();
00716 DST_set_last_file_name();
00717
00718 DST_ASSOC_INFO_st_idx(DST_INLINED_SUBROUTINE_low_pc (attr)) = low_pc;
00719 DST_ASSOC_INFO_st_idx(DST_INLINED_SUBROUTINE_high_pc(attr)) = high_pc;
00720
00721 DST_INLINED_SUBROUTINE_abstract_name(attr) = DST_mk_name(name);
00722
00723
00724
00725 if (*file_index == 0) {
00726 file_id = DST_get_file_id(filename, dirname, file_size, fmod_time);
00727 if (file_id == 0) {
00728 file_id = DST_enter_file(filename, dirname, file_size, fmod_time);
00729 }
00730 *file_index = file_id;
00731 }
00732
00733 USRCPOS_filenum(decl) = *file_index;
00734
00735 DST_INLINED_SUBROUTINE_decl(attr) = decl;
00736 DST_INLINED_SUBROUTINE_abstract_origin(attr) = abstract_origin;;
00737 DST_INLINED_SUBROUTINE_first_child(attr) = DST_INVALID_IDX;
00738 DST_INLINED_SUBROUTINE_last_child(attr) = DST_INVALID_IDX;
00739
00740 return DST_init_info(info_idx, DW_TAG_inlined_subroutine,
00741 flag, attr_idx);
00742 }
00743
00744 #endif
00745
00746
00747
00748 DST_INFO_IDX
00749 DST_mk_subprogram_memdef(USRCPOS decl,
00750 ST_IDX subpr,
00751 BOOL is_prototyped,
00752 DST_INFO_IDX spec)
00753 {
00754 DST_INFO_IDX info_idx;
00755 DST_ATTR_IDX attr_idx;
00756 DST_flag flag = DST_no_flag;
00757 DST_SUBPROGRAM *attr;
00758
00759 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00760 DST_enter_mk(DST_making_dbg_info, last_info_idx);
00761 #endif
00762 DST_check_info_idx(DW_TAG_subprogram, spec);
00763
00764 info_idx = DST_mk_info();
00765 attr_idx = DST_mk_attr(DST_SUBPROGRAM);
00766 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
00767 DST_SUBPROGRAM_memdef_decl(attr) = decl;
00768 DST_SUBPROGRAM_memdef_spec(attr) = spec;
00769
00770 DST_ASSOC_INFO_st_idx(DST_SUBPROGRAM_memdef_st(attr)) = subpr;
00771
00772 DST_SUBPROGRAM_memdef_first_child(attr) = DST_INVALID_IDX;
00773 DST_SUBPROGRAM_memdef_last_child(attr) = DST_INVALID_IDX;
00774
00775 DST_SET_memdef(flag);
00776 if (is_prototyped)
00777 DST_SET_prototyped(flag);
00778 return DST_init_info(info_idx, DW_TAG_subprogram,
00779 DST_flag_memdef, attr_idx);
00780 }
00781
00782
00783
00784
00785
00786 DST_INFO_IDX
00787 DST_mk_subprogram(USRCPOS decl,
00788 char *name,
00789 DST_INFO_IDX type,
00790 DST_INFO_IDX origin,
00791 ST_IDX subpr,
00792 DST_inline inlin,
00793 DST_virtuality virtuality,
00794 DST_vtable_elem_location vtable_elem_location,
00795 BOOL is_declaration,
00796 BOOL is_prototyped,
00797 #ifdef KEY
00798 BOOL is_artificial,
00799 #endif
00800 BOOL is_external)
00801 {
00802 DST_INFO_IDX info_idx;
00803 DST_ATTR_IDX attr_idx;
00804 DST_flag flag = DST_no_flag;
00805 DST_SUBPROGRAM *attr;
00806
00807 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
00808 DST_enter_mk(DST_making_dbg_info, last_info_idx);
00809 #endif
00810
00811 info_idx = DST_mk_info();
00812 attr_idx = DST_mk_attr(DST_SUBPROGRAM);
00813 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
00814 if (is_declaration)
00815 {
00816 DST_SUBPROGRAM_decl_decl(attr) = decl;
00817 DST_SUBPROGRAM_decl_name(attr) = DST_mk_name(name);
00818 DST_SUBPROGRAM_decl_linkage_name(attr) = DST_INVALID_IDX;
00819 DST_SUBPROGRAM_decl_type(attr) = type;
00820 DST_SUBPROGRAM_decl_origin(attr) = origin;
00821 DST_SUBPROGRAM_decl_inline(attr) = inlin;
00822 #ifdef CPLUSPLUSIL
00823 DST_SUBPROGRAM_decl_virtuality(attr) = virtuality;
00824 DST_SUBPROGRAM_decl_vtable_elem_location(attr) = vtable_elem_location;
00825 #endif
00826 DST_SUBPROGRAM_decl_first_child(attr) = DST_INVALID_IDX;
00827 DST_SUBPROGRAM_decl_last_child(attr) = DST_INVALID_IDX;
00828 DST_SET_declaration(flag);
00829 }
00830 else
00831 {
00832 DST_SUBPROGRAM_def_decl(attr) = decl;
00833 DST_SUBPROGRAM_def_name(attr) = DST_mk_name(name);
00834 DST_SUBPROGRAM_decl_linkage_name(attr) = DST_INVALID_IDX;
00835 DST_SUBPROGRAM_def_pubname(attr) = DST_INVALID_IDX;
00836 DST_SUBPROGRAM_def_specification(attr) = DST_INVALID_IDX;
00837 DST_SUBPROGRAM_def_type(attr) = type;
00838
00839 DST_ASSOC_INFO_st_idx(DST_SUBPROGRAM_def_st(attr)) = subpr;
00840
00841 DST_SUBPROGRAM_def_inline(attr) = inlin;
00842 #ifdef CPLUSPLUSIL
00843 DST_SUBPROGRAM_def_virtuality(attr) = virtuality;
00844 DST_SUBPROGRAM_def_vtable_elem_location(attr) = vtable_elem_location;
00845 #endif
00846 DST_SUBPROGRAM_def_clone_origin(attr) = DST_INVALID_IDX;
00847 DST_SUBPROGRAM_def_first_child(attr) = DST_INVALID_IDX;
00848 DST_SUBPROGRAM_def_last_child(attr) = DST_INVALID_IDX;
00849 }
00850 if (is_artificial)
00851 DST_SET_artificial(flag);
00852 if (is_prototyped)
00853 DST_SET_prototyped(flag);
00854 if (is_external)
00855 DST_SET_external(flag);
00856 DST_INFO_IDX t =
00857 DST_init_info(info_idx, DW_TAG_subprogram, flag, attr_idx);
00858 return t;
00859 }
00860
00861
00862
00863 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER)
00864
00865
00866
00867
00868
00869 void
00870 DST_subprogram_concrete_to_abstract(DST_INFO_IDX subprogram)
00871 {
00872 DST_INFO *info;
00873 DST_ATTR_IDX attr_idx;
00874 DST_SUBPROGRAM *attr;
00875 DST_flag flag;
00876
00877 info = DST_INFO_IDX_TO_PTR(subprogram);
00878
00879 DST_ASSERT((DST_INFO_tag(info) == DW_TAG_subprogram), "Bad DST_INFO_IDX input to DST_subprogram_concrete_to_abstract -- should be DW_TAG_subprogram");
00880
00881 flag = DST_INFO_flag(info);
00882 attr_idx = DST_INFO_attributes(info);
00883 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
00884
00885 if (DST_IS_declaration(flag))
00886 {
00887 if (DST_SUBPROGRAM_decl_inline(attr) == DW_INL_declared_not_inlined)
00888 DST_SUBPROGRAM_decl_inline(attr) = DW_INL_declared_inlined;
00889 else
00890 DST_SUBPROGRAM_decl_inline(attr) = DW_INL_inlined;
00891 }
00892 else
00893 {
00894 if (DST_SUBPROGRAM_def_inline(attr) == DW_INL_declared_not_inlined)
00895 DST_SUBPROGRAM_def_inline(attr) = DW_INL_declared_inlined;
00896 else
00897 DST_SUBPROGRAM_def_inline(attr) = DW_INL_inlined;
00898 }
00899 }
00900 #endif
00901
00902
00903 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER) || defined(_LEGO_CLONER)
00904
00905
00906
00907 DST_INFO_IDX
00908 DST_mk_cloned_subprogram(USRCPOS decl,
00909 char *name,
00910 DST_INFO_IDX type,
00911 DST_INFO_IDX clone_origin,
00912 ST_IDX subst,
00913 DST_inline inlin,
00914 DST_virtuality virtuality)
00915 {
00916 DST_INFO_IDX info_idx;
00917 DST_ATTR_IDX attr_idx;
00918 DST_flag flag = DST_no_flag;
00919 DST_SUBPROGRAM *attr;
00920
00921 info_idx = DST_mk_info();
00922 attr_idx = DST_mk_attr(DST_SUBPROGRAM);
00923 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
00924
00925 DST_SUBPROGRAM_def_decl(attr) = decl;
00926 DST_SUBPROGRAM_def_name(attr) = DST_mk_name(name);
00927 DST_SUBPROGRAM_decl_linkage_name(attr) = DST_INVALID_IDX;
00928 DST_SUBPROGRAM_def_pubname(attr) = DST_INVALID_IDX;
00929 DST_SUBPROGRAM_def_specification(attr) = DST_INVALID_IDX;
00930 DST_SUBPROGRAM_def_type(attr) = type;
00931
00932
00933
00934
00935 DST_ASSOC_INFO_st_idx(DST_SUBPROGRAM_def_st (attr)) = subst;
00936
00937
00938
00939
00940
00941 if (inlin == DW_INL_declared_inlined)
00942 DST_SUBPROGRAM_def_inline(attr) = DW_INL_declared_not_inlined;
00943 else
00944 DST_SUBPROGRAM_def_inline(attr) = DW_INL_not_inlined;
00945
00946 DST_SUBPROGRAM_def_virtuality(attr) = virtuality;
00947 DST_SUBPROGRAM_def_first_child(attr) = DST_INVALID_IDX;
00948 DST_SUBPROGRAM_def_last_child(attr) = DST_INVALID_IDX;
00949 DST_SUBPROGRAM_def_clone_origin(attr) = clone_origin;
00950 DST_SET_external(flag);
00951 return DST_init_info(info_idx, DW_TAG_subprogram, flag, attr_idx);
00952 }
00953 #endif
00954
00955
00956
00957
00958
00959
00960 void
00961 DST_add_pubname_to_subprogram (DST_INFO_IDX subprogram,
00962 char *pubname)
00963 {
00964 DST_INFO *info;
00965 DST_ATTR_IDX attr_idx;
00966 DST_SUBPROGRAM *attr;
00967
00968 info = DST_INFO_IDX_TO_PTR(subprogram);
00969 attr_idx = DST_INFO_attributes(info);
00970 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
00971
00972 DST_ASSERT(!(DST_IS_declaration (DST_INFO_flag(info))),
00973 "Try to put pubname on declaration");
00974
00975 DST_ASSERT (DST_INFO_tag(info) == DW_TAG_subprogram,
00976 "Try to set pubname on non subprogram");
00977
00978 DST_SUBPROGRAM_def_pubname(attr) = DST_mk_name(pubname);
00979 }
00980
00981
00982
00983
00984
00985
00986 void
00987 DST_add_linkage_name_to_subprogram(DST_INFO_IDX subprogram,
00988 char *linkage_name)
00989 {
00990 DST_INFO *info;
00991 DST_ATTR_IDX attr_idx;
00992 DST_SUBPROGRAM *attr;
00993
00994 info = DST_INFO_IDX_TO_PTR(subprogram);
00995 if(DST_INFO_tag(info) == DW_TAG_subprogram) {
00996 DST_ASSERT (DST_INFO_tag(info) == DW_TAG_subprogram,
00997 "Try to set linkage_name on non subprogram");
00998 attr_idx = DST_INFO_attributes(info);
00999 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBPROGRAM);
01000 if (DST_IS_declaration(DST_INFO_flag(info)))
01001 DST_SUBPROGRAM_decl_linkage_name(attr) = DST_mk_name(linkage_name);
01002 else
01003 DST_SUBPROGRAM_def_linkage_name(attr) = DST_mk_name(linkage_name);
01004 }
01005 }
01006
01007
01008
01009
01010
01011 void
01012 DST_add_specification_to_subprogram (DST_INFO_IDX subprogram_def,
01013 DST_INFO_IDX subprogram_decl)
01014 {
01015 DST_INFO *def_info;
01016 DST_ATTR_IDX def_attr_idx;
01017 DST_SUBPROGRAM *def_attr;
01018
01019 def_info = DST_INFO_IDX_TO_PTR(subprogram_def);
01020
01021 DST_ASSERT(!(DST_IS_declaration (DST_INFO_flag(def_info))),
01022 "Try to put specification on declaration");
01023 DST_ASSERT (DST_INFO_tag(def_info) == DW_TAG_subprogram,
01024 "Try to set specification on non subprogram");
01025
01026 def_attr_idx = DST_INFO_attributes(def_info);
01027 def_attr = DST_ATTR_IDX_TO_PTR(def_attr_idx, DST_SUBPROGRAM);
01028 DST_SUBPROGRAM_def_specification(def_attr) = subprogram_decl;
01029 }
01030
01031
01032
01033
01034 void
01035 DST_add_specification_to_variable (DST_INFO_IDX variable_def,
01036 DST_INFO_IDX field_decl)
01037 {
01038 DST_INFO *def_info;
01039 DST_ATTR_IDX def_attr_idx;
01040 DST_VARIABLE *def_attr;
01041
01042 def_info = DST_INFO_IDX_TO_PTR(variable_def);
01043
01044 DST_ASSERT(!(DST_IS_declaration (DST_INFO_flag(def_info))),
01045 "Try to put specification on declaration");
01046 DST_ASSERT (DST_INFO_tag(def_info) == DW_TAG_variable,
01047 "Try to set field specification on non variable");
01048
01049 def_attr_idx = DST_INFO_attributes(def_info);
01050 def_attr = DST_ATTR_IDX_TO_PTR(def_attr_idx, DST_VARIABLE);
01051 DST_VARIABLE_def_specification(def_attr) = field_decl;
01052 }
01053
01054 #ifdef KEY
01055
01056
01057 void
01058 DST_add_linkage_name_to_variable (DST_INFO_IDX variable_def,
01059 char *linkage_name)
01060 {
01061 DST_INFO *info;
01062 DST_ATTR_IDX attr_idx;
01063 DST_VARIABLE *attr;
01064
01065 info = DST_INFO_IDX_TO_PTR(variable_def);
01066
01067 DST_ASSERT (DST_INFO_tag(info) == DW_TAG_variable,
01068 "Try to set field linkage_name on non variable");
01069
01070 attr_idx = DST_INFO_attributes(info);
01071 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VARIABLE);
01072
01073 if (DST_IS_declaration(DST_INFO_flag(info))) {
01074 DST_VARIABLE_decl_linkage_name(attr) = DST_mk_name(linkage_name);
01075 } else {
01076 DST_VARIABLE_def_linkage_name(attr) = DST_mk_name(linkage_name);
01077 }
01078 }
01079
01080 #endif
01081
01082
01083
01084 DST_INFO_IDX
01085 DST_mk_entry_point(USRCPOS decl,
01086 char *name,
01087 DST_INFO_IDX type,
01088 ST_IDX subpr)
01089 {
01090 DST_INFO_IDX info_idx;
01091 DST_ATTR_IDX attr_idx;
01092 DST_flag flag = DST_no_flag;
01093 DST_ENTRY_POINT *attr;
01094
01095 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01096 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01097 #endif
01098
01099 info_idx = DST_mk_info();
01100 attr_idx = DST_mk_attr(DST_ENTRY_POINT);
01101 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_ENTRY_POINT);
01102
01103 DST_ENTRY_POINT_name(attr) = DST_mk_name(name);
01104 DST_ENTRY_POINT_type(attr) = type;
01105 DST_ENTRY_POINT_decl(attr) = decl;
01106 DST_ENTRY_POINT_first_child(attr) = DST_INVALID_IDX;
01107 DST_ENTRY_POINT_last_child(attr) = DST_INVALID_IDX;
01108 DST_ASSOC_INFO_st_idx(DST_ENTRY_POINT_st(attr)) = subpr;
01109 return DST_init_info(info_idx, DW_TAG_entry_point, flag, attr_idx);
01110 }
01111
01112
01113
01114
01115 DST_INFO_IDX
01116 DST_mk_common_block(char *name,
01117 ST_IDX subpr)
01118 {
01119 DST_INFO_IDX info_idx;
01120 DST_ATTR_IDX attr_idx;
01121 DST_flag flag = DST_no_flag;
01122 DST_COMMON_BLOCK *attr;
01123
01124 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01125 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01126 #endif
01127
01128 info_idx = DST_mk_info();
01129 attr_idx = DST_mk_attr(DST_COMMON_BLOCK);
01130 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_COMMON_BLOCK);
01131 DST_COMMON_BLOCK_name(attr) = DST_mk_name(name);
01132 DST_COMMON_BLOCK_first_child(attr) = DST_INVALID_IDX;
01133 DST_COMMON_BLOCK_last_child(attr) = DST_INVALID_IDX;
01134 DST_ASSOC_INFO_st_idx(DST_COMMON_BLOCK_st(attr)) = subpr;
01135 return DST_init_info(info_idx, DW_TAG_common_block, flag, attr_idx);
01136 }
01137
01138
01139
01140
01141 DST_INFO_IDX
01142 DST_mk_common_incl( USRCPOS decl,
01143 DST_INFO_IDX comblk)
01144 {
01145 DST_INFO_IDX info_idx;
01146 DST_ATTR_IDX attr_idx;
01147 DST_flag flag = DST_no_flag;
01148 DST_COMMON_INCL *attr;
01149
01150 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01151 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01152 #endif
01153
01154 info_idx = DST_mk_info();
01155 attr_idx = DST_mk_attr(DST_COMMON_INCL);
01156 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_COMMON_INCL);
01157 DST_COMMON_INCL_decl(attr) = decl;
01158 DST_COMMON_INCL_com_blk(attr) = comblk;
01159 return DST_init_info(info_idx, DW_TAG_common_inclusion, flag, attr_idx);
01160 }
01161
01162 #ifdef KEY
01163
01164
01165
01166 DST_INFO_IDX
01167 DST_mk_imported_decl( char *mangled_name,
01168 char *name)
01169 {
01170 DST_INFO_IDX info_idx;
01171 DST_ATTR_IDX attr_idx;
01172 DST_IMPORTED_DECL *attr;
01173
01174 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01175 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01176 #endif
01177
01178 info_idx = DST_mk_info();
01179 attr_idx = DST_mk_attr(DST_IMPORTED_DECL);
01180 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_IMPORTED_DECL);
01181
01182
01183
01184 DST_IMPORTED_DECL_import(attr) ;
01185 DST_IMPORTED_DECL_name(attr) = DST_mk_name(name);
01186 return DST_init_info(info_idx, DW_TAG_imported_declaration, DST_no_flag,
01187 attr_idx);
01188 }
01189
01190
01191
01192
01193 DST_INFO_IDX
01194 DST_mk_module(USRCPOS decl,
01195 char *name)
01196 {
01197 DST_INFO_IDX info_idx;
01198 DST_ATTR_IDX attr_idx;
01199 DST_flag flag = DST_no_flag;
01200 DST_MODULE *attr;
01201
01202 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01203 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01204 #endif
01205
01206 info_idx = DST_mk_info();
01207 attr_idx = DST_mk_attr(DST_MODULE);
01208 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_MODULE);
01209 DST_MODULE_decl(attr) = decl;
01210 DST_MODULE_name(attr) = DST_mk_name(name);
01211 DST_MODULE_first_child(attr) = DST_INVALID_IDX;
01212 DST_MODULE_last_child(attr) = DST_INVALID_IDX;
01213 DST_SET_declaration(flag);
01214 DST_INFO_IDX t =
01215 DST_init_info(info_idx, DW_TAG_module, flag, attr_idx);
01216 return t;
01217 }
01218 #endif
01219
01220
01221
01222 DST_INFO_IDX
01223 DST_mk_lexical_block(char *name,
01224 ST_IDX low_pc,
01225 ST_IDX high_pc,
01226 DST_INFO_IDX abstract_origin)
01227 {
01228 DST_INFO_IDX info_idx;
01229 DST_ATTR_IDX attr_idx;
01230 DST_flag flag = DST_no_flag;
01231 DST_LEXICAL_BLOCK *attr;
01232
01233 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01234 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01235 #endif
01236 info_idx = DST_mk_info();
01237 attr_idx = DST_mk_attr(DST_LEXICAL_BLOCK);
01238 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_LEXICAL_BLOCK);
01239 DST_LEXICAL_BLOCK_name(attr) = DST_mk_name(name);
01240 if (low_pc != ST_IDX_ZERO && high_pc != ST_IDX_ZERO)
01241 {
01242 DST_ASSOC_INFO_st_idx(DST_LEXICAL_BLOCK_low_pc(attr)) = low_pc;
01243 DST_ASSOC_INFO_st_idx(DST_LEXICAL_BLOCK_high_pc(attr)) = high_pc;
01244 }
01245 DST_LEXICAL_BLOCK_abstract_origin(attr) = abstract_origin;
01246 DST_LEXICAL_BLOCK_first_child(attr) = DST_INVALID_IDX;
01247 DST_LEXICAL_BLOCK_last_child(attr) = DST_INVALID_IDX;
01248
01249 return DST_init_info(info_idx, DW_TAG_lexical_block, flag, attr_idx);
01250 }
01251
01252
01253
01254
01255
01256 extern DST_INFO_IDX
01257 DST_mk_label(char *name,
01258 ST_IDX low_pc,
01259 DST_INFO_IDX abstract_origin)
01260 {
01261 DST_INFO_IDX info_idx;
01262 DST_ATTR_IDX attr_idx;
01263 DST_flag flag = DST_no_flag;
01264 DST_LABEL *attr;
01265
01266 DST_ASSERT(low_pc != ST_IDX_ZERO, "Missing low_pc value for label");
01267
01268 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01269 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01270 #endif
01271 info_idx = DST_mk_info();
01272 attr_idx = DST_mk_attr(DST_LABEL);
01273 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_LABEL);
01274 DST_LABEL_name(attr) = DST_mk_name(name);
01275
01276 DST_ASSOC_INFO_st_idx(DST_LABEL_low_pc(attr)) = low_pc;
01277
01278 DST_LABEL_abstract_origin(attr) = abstract_origin;
01279 return DST_init_info(info_idx, DW_TAG_label, flag, attr_idx);
01280 }
01281
01282
01283
01284
01285
01286
01287 DST_INFO_IDX
01288 DST_mk_variable_const(USRCPOS decl,
01289 char *name,
01290 DST_INFO_IDX type,
01291 BOOL is_automatic,
01292 BOOL is_external,
01293 DST_CONST_VALUE cval)
01294 {
01295 DST_INFO_IDX info_idx;
01296 DST_ATTR_IDX attr_idx;
01297 DST_flag flag = DST_no_flag;
01298 DST_VARIABLE *attr;
01299
01300 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01301 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01302 #endif
01303
01304 info_idx = DST_mk_info();
01305 attr_idx = DST_mk_attr(DST_VARIABLE);
01306 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VARIABLE);
01307 DST_VARIABLE_constant_decl(attr) = decl;
01308 DST_VARIABLE_constant_name(attr) = DST_mk_name(name);
01309 DST_VARIABLE_constant_type(attr) = type;
01310 DST_VARIABLE_constant_cval(attr) = cval;
01311 DST_SET_const(flag);
01312 if (is_automatic)
01313 DST_SET_automatic(flag);
01314 else if (is_external)
01315 DST_SET_external(flag);
01316 return DST_init_info(info_idx, DW_TAG_variable, flag, attr_idx);
01317 }
01318
01319
01320
01321
01322 DST_INFO_IDX
01323 DST_mk_variable_comm( USRCPOS decl,
01324 char *name,
01325 DST_INFO_IDX type,
01326 ST_IDX var,
01327 UINT64 offset)
01328 {
01329 DST_INFO_IDX info_idx;
01330 DST_ATTR_IDX attr_idx;
01331 DST_flag flag = DST_no_flag;
01332 DST_VARIABLE *attr;
01333
01334 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01335 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01336 #endif
01337
01338 info_idx = DST_mk_info();
01339 attr_idx = DST_mk_attr(DST_VARIABLE);
01340 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VARIABLE);
01341 DST_VARIABLE_comm_decl(attr) = decl;
01342 DST_VARIABLE_comm_name(attr) = DST_mk_name(name);
01343 DST_VARIABLE_comm_type(attr) = type;
01344 DST_ASSOC_INFO_st_idx(DST_VARIABLE_comm_st(attr)) = var;
01345 DST_VARIABLE_comm_offs(attr) = offset;
01346 DST_SET_comm(flag);
01347 return DST_init_info(info_idx, DW_TAG_variable, flag, attr_idx);
01348 }
01349
01350
01351
01352
01353 DST_INFO_IDX
01354 DST_mk_variable_memdef(USRCPOS decl,
01355 ST_IDX var,
01356 DST_INFO_IDX spec)
01357 {
01358 DST_INFO_IDX info_idx;
01359 DST_ATTR_IDX attr_idx;
01360 DST_flag flag = DST_no_flag;
01361 DST_VARIABLE *attr;
01362
01363 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01364 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01365 #endif
01366
01367 info_idx = DST_mk_info();
01368 attr_idx = DST_mk_attr(DST_VARIABLE);
01369 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VARIABLE);
01370 DST_VARIABLE_memdef_decl(attr) = decl;
01371 DST_VARIABLE_memdef_spec(attr) = spec;
01372
01373
01374 DST_ASSOC_INFO_st_idx(DST_VARIABLE_memdef_st(attr)) = var;
01375
01376 DST_SET_memdef(flag);
01377 return DST_init_info(info_idx, DW_TAG_variable, flag, attr_idx);
01378 }
01379
01380
01381
01382
01383
01384 DST_INFO_IDX
01385 DST_mk_variable(USRCPOS decl,
01386 char *name,
01387 DST_INFO_IDX type,
01388 UINT64 offs,
01389 ST_IDX var,
01390 DST_INFO_IDX abstract_origin,
01391 BOOL is_declaration,
01392 BOOL is_automatic,
01393 BOOL is_external,
01394 BOOL is_artificial)
01395 {
01396 DST_INFO_IDX info_idx;
01397 DST_ATTR_IDX attr_idx;
01398 DST_flag flag = DST_no_flag;
01399 DST_VARIABLE *attr;
01400
01401 DST_ASSERT(!(is_automatic && is_declaration), "automatic must be def!");
01402
01403 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01404 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01405 #endif
01406 info_idx = DST_mk_info();
01407 attr_idx = DST_mk_attr(DST_VARIABLE);
01408 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VARIABLE);
01409 if (is_declaration)
01410 {
01411 DST_VARIABLE_decl_decl(attr) = decl;
01412 DST_VARIABLE_decl_name(attr) = DST_mk_name(name);
01413 DST_VARIABLE_decl_type(attr) = type;
01414 #ifdef KEY
01415 DST_VARIABLE_decl_linkage_name(attr) = DST_INVALID_IDX;
01416 #endif
01417 DST_SET_declaration(flag);
01418 }
01419 else
01420 {
01421 DST_VARIABLE_def_decl(attr) = decl;
01422 DST_VARIABLE_def_name(attr) = DST_mk_name(name);
01423 DST_VARIABLE_def_type(attr) = type;
01424 DST_VARIABLE_def_offs(attr) = offs;
01425 DST_VARIABLE_def_abstract_origin(attr) = abstract_origin;
01426 DST_VARIABLE_def_specification(attr) = DST_INVALID_IDX;
01427 #ifdef KEY
01428 DST_VARIABLE_def_linkage_name(attr) = DST_INVALID_IDX;
01429 #endif
01430
01431
01432 DST_ASSOC_INFO_st_idx(DST_VARIABLE_def_st(attr)) = var;
01433 }
01434 if (is_automatic)
01435 DST_SET_automatic(flag);
01436 else if (is_external)
01437 DST_SET_external(flag);
01438 if (is_artificial)
01439 DST_SET_artificial(flag);
01440 return DST_init_info(info_idx, DW_TAG_variable, flag, attr_idx);
01441 }
01442
01443
01444
01445
01446 DST_INFO_IDX
01447 DST_mk_formal_parameter(USRCPOS decl,
01448 char *name,
01449 DST_INFO_IDX type,
01450 ST_IDX parm,
01451 DST_INFO_IDX abstract_origin,
01452 DST_INFO_IDX default_val,
01453 BOOL is_optional,
01454 BOOL is_variable,
01455
01456
01457
01458
01459
01460 BOOL is_artificial,
01461 BOOL is_declaration_only)
01462 {
01463 DST_INFO_IDX info_idx;
01464 DST_ATTR_IDX attr_idx;
01465 DST_flag flag = DST_no_flag;
01466 DST_FORMAL_PARAMETER *attr;
01467
01468 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01469 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01470 #endif
01471
01472 info_idx = DST_mk_info();
01473 attr_idx = DST_mk_attr(DST_FORMAL_PARAMETER);
01474 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_FORMAL_PARAMETER);
01475 DST_FORMAL_PARAMETER_decl(attr) = decl;
01476 if (name != NULL)
01477 DST_FORMAL_PARAMETER_name(attr) = DST_mk_name(name);
01478 else
01479 DST_FORMAL_PARAMETER_name(attr) = DST_INVALID_IDX;
01480 DST_FORMAL_PARAMETER_type(attr) = type;
01481
01482
01483 DST_ASSOC_INFO_st_idx(DST_FORMAL_PARAMETER_st(attr)) = parm;
01484
01485 DST_FORMAL_PARAMETER_default_val(attr) = default_val;
01486 DST_FORMAL_PARAMETER_abstract_origin(attr) = abstract_origin;
01487 if (is_declaration_only)
01488 DST_SET_declaration(flag);
01489 if (is_optional)
01490 DST_SET_optional_parm(flag);
01491 if (is_variable)
01492 DST_SET_variable_parm(flag);
01493 if (is_artificial)
01494 DST_SET_artificial(flag);
01495 return DST_init_info(info_idx, DW_TAG_formal_parameter, flag, attr_idx);
01496 }
01497
01498
01499
01500
01501
01502 DST_INFO_IDX
01503 DST_mk_unspecified_parameters(USRCPOS decl,
01504 DST_INFO_IDX abstract_origin)
01505 {
01506 DST_INFO_IDX info_idx;
01507 DST_ATTR_IDX attr_idx;
01508 DST_flag flag = DST_no_flag;
01509 DST_UNSPECIFIED_PARAMETERS *attr;
01510
01511 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01512 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01513 #endif
01514
01515 info_idx = DST_mk_info();
01516 attr_idx = DST_mk_attr(DST_UNSPECIFIED_PARAMETERS);
01517 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_UNSPECIFIED_PARAMETERS);
01518 DST_UNSPECIFIED_PARAMETERS_decl(attr) = decl;
01519 DST_UNSPECIFIED_PARAMETERS_abstract_origin(attr) = abstract_origin;
01520 return DST_init_info(info_idx, DW_TAG_unspecified_parameters,
01521 flag, attr_idx);
01522 }
01523
01524
01525
01526
01527 DST_INFO_IDX
01528 DST_mk_constant_def(USRCPOS decl,
01529 char *name,
01530 DST_INFO_IDX type,
01531 DST_CONST_VALUE cval,
01532 BOOL is_external)
01533 {
01534 DST_INFO_IDX info_idx;
01535 DST_ATTR_IDX attr_idx;
01536 DST_flag flag = DST_no_flag;
01537 DST_CONSTANT *attr;
01538
01539 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01540 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01541 #endif
01542
01543 info_idx = DST_mk_info();
01544 attr_idx = DST_mk_attr(DST_CONSTANT);
01545 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_CONSTANT);
01546 DST_CONSTANT_def_decl(attr) = decl;
01547 DST_CONSTANT_def_name(attr) = DST_mk_name(name);
01548 DST_CONSTANT_def_type(attr) = type;
01549 DST_CONSTANT_def_cval(attr) = cval;
01550 if (is_external)
01551 DST_SET_external(flag);
01552 return DST_init_info(info_idx, DW_TAG_constant, flag, attr_idx);
01553 }
01554
01555
01556
01557
01558
01559 DST_INFO_IDX
01560 DST_mk_constant_decl(USRCPOS decl,
01561 char *name,
01562 DST_INFO_IDX type,
01563 BOOL is_external)
01564 {
01565 DST_INFO_IDX info_idx;
01566 DST_ATTR_IDX attr_idx;
01567 DST_flag flag = DST_no_flag;
01568 DST_CONSTANT *attr;
01569
01570 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01571 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01572 #endif
01573
01574 info_idx = DST_mk_info();
01575 attr_idx = DST_mk_attr(DST_CONSTANT);
01576 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_CONSTANT);
01577 DST_CONSTANT_decl_decl(attr) = decl;
01578 DST_CONSTANT_decl_name(attr) = DST_mk_name(name);
01579 DST_CONSTANT_decl_type(attr) = type;
01580 if (is_external)
01581 DST_SET_external(flag);
01582 DST_SET_declaration(flag);
01583 return DST_init_info(info_idx, DW_TAG_constant, flag, attr_idx);
01584 }
01585
01586
01587
01588
01589
01590 DST_INFO_IDX
01591 DST_mk_basetype(const char *name,
01592 DST_ATE_encoding encoding,
01593 DST_size_t byte_size)
01594 {
01595 DST_INFO_IDX info_idx;
01596 DST_ATTR_IDX attr_idx;
01597 DST_flag flag = DST_no_flag;
01598 DST_BASETYPE *attr;
01599
01600 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01601 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01602 #endif
01603
01604 info_idx = DST_mk_info();
01605 attr_idx = DST_mk_attr(DST_BASETYPE);
01606 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_BASETYPE);
01607 DST_BASETYPE_name(attr) = DST_mk_name(name);
01608 DST_BASETYPE_encoding(attr) = encoding;
01609 DST_BASETYPE_byte_size(attr) = byte_size;
01610
01611 return DST_init_info(info_idx, DW_TAG_base_type, flag, attr_idx);
01612 }
01613
01614
01615
01616
01617 DST_INFO_IDX
01618 DST_mk_const_type(DST_INFO_IDX type)
01619 {
01620 DST_INFO_IDX info_idx;
01621 DST_ATTR_IDX attr_idx;
01622 DST_flag flag = DST_no_flag;
01623 DST_CONST_TYPE *attr;
01624
01625 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01626 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01627 #endif
01628
01629 info_idx = DST_mk_info();
01630 attr_idx = DST_mk_attr(DST_CONST_TYPE);
01631 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_CONST_TYPE);
01632 DST_CONST_TYPE_type(attr) = type;
01633 return DST_init_info(info_idx, DW_TAG_const_type, flag, attr_idx);
01634 }
01635
01636
01637
01638
01639 DST_INFO_IDX
01640 DST_mk_volatile_type(DST_INFO_IDX type)
01641 {
01642 DST_INFO_IDX info_idx;
01643 DST_ATTR_IDX attr_idx;
01644 DST_flag flag = DST_no_flag;
01645 DST_VOLATILE_TYPE *attr;
01646
01647 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01648 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01649 #endif
01650
01651 info_idx = DST_mk_info();
01652 attr_idx = DST_mk_attr(DST_VOLATILE_TYPE);
01653 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_VOLATILE_TYPE);
01654 DST_VOLATILE_TYPE_type(attr) = type;
01655 return DST_init_info(info_idx, DW_TAG_volatile_type, flag, attr_idx);
01656 }
01657
01658
01659
01660
01661 DST_INFO_IDX
01662 DST_mk_pointer_type(DST_INFO_IDX type,
01663 DST_addr_class address_class,
01664 DST_size_t byte_size)
01665 {
01666 DST_INFO_IDX info_idx;
01667 DST_ATTR_IDX attr_idx;
01668 DST_flag flag = DST_no_flag;
01669 DST_POINTER_TYPE *attr;
01670
01671 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01672 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01673 #endif
01674
01675 info_idx = DST_mk_info();
01676 attr_idx = DST_mk_attr(DST_POINTER_TYPE);
01677 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_POINTER_TYPE);
01678 DST_POINTER_TYPE_type(attr) = type;
01679 DST_POINTER_TYPE_address_class(attr) = address_class;
01680 DST_POINTER_TYPE_byte_size(attr) = byte_size;
01681 return DST_init_info(info_idx, DW_TAG_pointer_type, flag, attr_idx);
01682 }
01683
01684
01685
01686
01687 DST_INFO_IDX
01688 DST_mk_reference_type(DST_INFO_IDX type,
01689 DST_addr_class address_class,
01690 DST_size_t byte_size)
01691 {
01692 DST_INFO_IDX info_idx;
01693 DST_ATTR_IDX attr_idx;
01694 DST_flag flag = DST_no_flag;
01695 DST_REFERENCE_TYPE *attr;
01696
01697 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01698 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01699 #endif
01700
01701 info_idx = DST_mk_info();
01702 attr_idx = DST_mk_attr(DST_REFERENCE_TYPE);
01703 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_REFERENCE_TYPE);
01704 DST_REFERENCE_TYPE_type(attr) = type;
01705 DST_REFERENCE_TYPE_address_class(attr) = address_class;
01706 DST_REFERENCE_TYPE_byte_size(attr) = byte_size;
01707 return DST_init_info(info_idx, DW_TAG_reference_type, flag, attr_idx);
01708 }
01709
01710
01711
01712
01713 DST_INFO_IDX
01714 DST_mk_typedef(USRCPOS decl,
01715 char *name,
01716 DST_INFO_IDX type,
01717 DST_INFO_IDX abstract_origin)
01718 {
01719 DST_INFO_IDX info_idx;
01720 DST_ATTR_IDX attr_idx;
01721 DST_flag flag = DST_no_flag;
01722 DST_TYPEDEF *attr;
01723
01724 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01725 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01726 #endif
01727
01728 info_idx = DST_mk_info();
01729 attr_idx = DST_mk_attr(DST_TYPEDEF);
01730 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_TYPEDEF);
01731 DST_TYPEDEF_decl(attr) = decl;
01732 DST_TYPEDEF_name(attr) = DST_mk_name(name);
01733 DST_TYPEDEF_type(attr) = type;
01734 DST_TYPEDEF_abstract_origin(attr) = abstract_origin;
01735 return DST_init_info(info_idx, DW_TAG_typedef, flag, attr_idx);
01736 }
01737
01738
01739
01740 DST_INFO_IDX
01741 DST_mk_ptr_to_member_type(USRCPOS decl,
01742 char * name,
01743 DST_INFO_IDX type,
01744 DST_INFO_IDX class_type)
01745 {
01746 DST_INFO_IDX info_idx;
01747 DST_ATTR_IDX attr_idx;
01748 DST_flag flag = DST_no_flag;
01749 DST_PTR_TO_MEMBER_TYPE *attr;
01750
01751 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01752 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01753 #endif
01754
01755 info_idx = DST_mk_info();
01756 attr_idx = DST_mk_attr(DST_PTR_TO_MEMBER_TYPE);
01757 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_PTR_TO_MEMBER_TYPE);
01758 DST_PTR_TO_MEMBER_TYPE_name(attr) = DST_mk_name(name);
01759 DST_PTR_TO_MEMBER_TYPE_type(attr) = type;
01760 DST_PTR_TO_MEMBER_TYPE_class_type(attr) = class_type;
01761 return DST_init_info(info_idx,
01762 DW_TAG_ptr_to_member_type,
01763 flag,
01764 attr_idx);
01765 }
01766
01767
01768
01769 DST_INFO_IDX
01770 DST_mk_array_type(USRCPOS decl,
01771 char *name,
01772 DST_INFO_IDX type,
01773 DST_size_t byte_size,
01774 DST_INFO_IDX abstract_origin,
01775 BOOL is_incomplete)
01776 {
01777 DST_INFO_IDX info_idx;
01778 DST_ATTR_IDX attr_idx;
01779 DST_flag flag = DST_no_flag;
01780 DST_ARRAY_TYPE *attr;
01781
01782 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01783 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01784 #endif
01785
01786 info_idx = DST_mk_info();
01787 attr_idx = DST_mk_attr(DST_ARRAY_TYPE);
01788 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_ARRAY_TYPE);
01789 DST_ARRAY_TYPE_decl(attr) = decl;
01790 DST_ARRAY_TYPE_name(attr) = DST_mk_name(name);
01791 DST_ARRAY_TYPE_type(attr) = type;
01792 DST_ARRAY_TYPE_byte_size(attr) = byte_size;
01793 DST_ARRAY_TYPE_abstract_origin(attr) = abstract_origin;
01794 DST_ARRAY_TYPE_first_child(attr) = DST_INVALID_IDX;
01795 DST_ARRAY_TYPE_last_child(attr) = DST_INVALID_IDX;
01796 if (is_incomplete)
01797 DST_SET_declaration(flag);
01798 return DST_init_info(info_idx, DW_TAG_array_type, flag, attr_idx);
01799 }
01800
01801
01802
01803
01804 DST_INFO_IDX
01805 DST_mk_subrange_type(DST_flag is_lb_cval,
01806 DST_cval_ref low,
01807 DST_flag is_ub_cval,
01808 DST_cval_ref high)
01809 {
01810 DST_INFO_IDX info_idx;
01811 DST_ATTR_IDX attr_idx;
01812 DST_flag flag = DST_no_flag;
01813 DST_SUBRANGE_TYPE *attr;
01814
01815 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01816 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01817 #endif
01818
01819 info_idx = DST_mk_info();
01820 attr_idx = DST_mk_attr(DST_SUBRANGE_TYPE);
01821 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBRANGE_TYPE);
01822 if (is_lb_cval) {
01823 DST_SUBRANGE_TYPE_lower_cval(attr) = low.cval;
01824 DST_SET_lb_cval(flag);
01825 } else {
01826 DST_SUBRANGE_TYPE_lower_ref(attr) = low.ref;
01827 }
01828 if (is_ub_cval) {
01829 DST_SUBRANGE_TYPE_upper_cval(attr) = high.cval;
01830 DST_SET_ub_cval(flag);
01831 } else {
01832 DST_SUBRANGE_TYPE_upper_ref(attr) = high.ref;
01833 }
01834
01835 DST_SUBRANGE_TYPE_stride_ref(attr) = DST_INVALID_IDX ;
01836
01837 return DST_init_info(info_idx, DW_TAG_subrange_type, flag, attr_idx);
01838 }
01839
01840
01841
01842
01843 extern DST_INFO_IDX
01844 DST_mk_string_type(USRCPOS decl,
01845 char *name,
01846 DST_flag is_len_cval,
01847 DST_cval_ref len)
01848 {
01849 DST_INFO_IDX info_idx;
01850 DST_ATTR_IDX attr_idx;
01851 DST_flag flag = DST_no_flag;
01852 DST_STRING_TYPE *attr;
01853
01854 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01855 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01856 #endif
01857
01858 info_idx = DST_mk_info();
01859 attr_idx = DST_mk_attr(DST_STRING_TYPE);
01860 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_STRING_TYPE);
01861 DST_STRING_TYPE_decl(attr) = decl;
01862 DST_STRING_TYPE_name(attr) = DST_mk_name(name);
01863 if (is_len_cval) {
01864 DST_STRING_TYPE_len_cval(attr) = len.cval;
01865 DST_SET_cval(flag);
01866 } else {
01867 DST_STRING_TYPE_len_ref(attr) = len.ref;
01868 }
01869 return DST_init_info(info_idx, DW_TAG_string_type, flag, attr_idx);
01870 }
01871
01872
01873
01874
01875 DST_INFO_IDX
01876 DST_mk_structure_type(USRCPOS decl,
01877 char *name,
01878 DST_size_t byte_size,
01879 DST_INFO_IDX abstract_origin,
01880 BOOL is_incomplete)
01881 {
01882 DST_INFO_IDX info_idx;
01883 DST_ATTR_IDX attr_idx;
01884 DST_flag flag = DST_no_flag;
01885 DST_STRUCTURE_TYPE *attr;
01886
01887 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01888 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01889 #endif
01890
01891 info_idx = DST_mk_info();
01892 attr_idx = DST_mk_attr(DST_STRUCTURE_TYPE);
01893 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_STRUCTURE_TYPE);
01894 DST_STRUCTURE_TYPE_decl(attr) = decl;
01895 DST_STRUCTURE_TYPE_name(attr) = DST_mk_name(name);
01896 DST_STRUCTURE_TYPE_byte_size(attr) = byte_size;
01897 DST_STRUCTURE_TYPE_abstract_origin(attr) = abstract_origin;
01898 DST_STRUCTURE_TYPE_first_child(attr) = DST_INVALID_IDX;
01899 DST_STRUCTURE_TYPE_last_child(attr) = DST_INVALID_IDX;
01900 if (is_incomplete)
01901 DST_SET_declaration(flag);
01902 return DST_init_info(info_idx, DW_TAG_structure_type, flag, attr_idx);
01903 }
01904
01905
01906
01907
01908 DST_INFO_IDX
01909 DST_mk_union_type(USRCPOS decl,
01910 char *name,
01911 DST_size_t byte_size,
01912 DST_INFO_IDX abstract_origin,
01913 BOOL is_incomplete)
01914 {
01915 DST_INFO_IDX info_idx;
01916 DST_ATTR_IDX attr_idx;
01917 DST_flag flag = DST_no_flag;
01918 DST_UNION_TYPE *attr;
01919
01920 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01921 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01922 #endif
01923
01924 info_idx = DST_mk_info();
01925 attr_idx = DST_mk_attr(DST_UNION_TYPE);
01926 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_UNION_TYPE);
01927 DST_UNION_TYPE_decl(attr) = decl;
01928 DST_UNION_TYPE_name(attr) = DST_mk_name(name);
01929 DST_UNION_TYPE_byte_size(attr) = byte_size;
01930 DST_UNION_TYPE_abstract_origin(attr) = abstract_origin;
01931 DST_UNION_TYPE_first_child(attr) = DST_INVALID_IDX;
01932 DST_UNION_TYPE_last_child(attr) = DST_INVALID_IDX;
01933 if (is_incomplete)
01934 DST_SET_declaration(flag);
01935 return DST_init_info(info_idx, DW_TAG_union_type, flag, attr_idx);
01936 }
01937
01938
01939
01940
01941 DST_INFO_IDX
01942 DST_mk_class_type(USRCPOS decl,
01943 char *name,
01944 DST_size_t byte_size,
01945 DST_INFO_IDX abstract_origin,
01946 BOOL is_incomplete)
01947 {
01948 DST_INFO_IDX info_idx;
01949 DST_ATTR_IDX attr_idx;
01950 DST_flag flag = DST_no_flag;
01951 DST_CLASS_TYPE *attr;
01952
01953 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
01954 DST_enter_mk(DST_making_dbg_info, last_info_idx);
01955 #endif
01956
01957 info_idx = DST_mk_info();
01958 attr_idx = DST_mk_attr(DST_CLASS_TYPE);
01959 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_CLASS_TYPE);
01960 DST_CLASS_TYPE_decl(attr) = decl;
01961 DST_CLASS_TYPE_name(attr) = DST_mk_name(name);
01962 DST_CLASS_TYPE_byte_size(attr) = byte_size;
01963 DST_CLASS_TYPE_abstract_origin(attr) = abstract_origin;
01964 DST_CLASS_TYPE_first_child(attr) = DST_INVALID_IDX;
01965 DST_CLASS_TYPE_last_child(attr) = DST_INVALID_IDX;
01966 if (is_incomplete)
01967 DST_SET_declaration(flag);
01968 return DST_init_info(info_idx, DW_TAG_class_type, flag, attr_idx);
01969 }
01970
01971
01972
01973
01974
01975
01976
01977 #ifndef KEY
01978 DST_INFO_IDX
01979 DST_mk_member(USRCPOS decl,
01980 char *name,
01981 DST_INFO_IDX type,
01982 DST_size_t memb_loc,
01983 DST_size_t byte_size,
01984 DST_bitsize bit_offset,
01985 DST_bitsize bit_size,
01986 BOOL is_bitfield,
01987 BOOL is_static,
01988 BOOL is_declaration,
01989 BOOL is_artificial)
01990 #else
01991 DST_INFO_IDX
01992 DST_mk_member(USRCPOS decl,
01993 char *name,
01994 DST_INFO_IDX type,
01995 DST_size_t memb_loc,
01996 DST_size_t byte_size,
01997 DST_bitsize bit_offset,
01998 DST_bitsize bit_size,
01999 BOOL is_bitfield,
02000 BOOL is_static,
02001 BOOL is_declaration,
02002 BOOL is_artificial,
02003 DST_accessibility accessibility)
02004 #endif
02005 {
02006 DST_INFO_IDX info_idx;
02007 DST_ATTR_IDX attr_idx;
02008 DST_flag flag = DST_no_flag;
02009 DST_MEMBER *attr;
02010
02011 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02012 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02013 #endif
02014
02015 info_idx = DST_mk_info();
02016 attr_idx = DST_mk_attr(DST_MEMBER);
02017 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_MEMBER);
02018 DST_MEMBER_decl(attr) = decl;
02019 DST_MEMBER_name(attr) = DST_mk_name(name);
02020 DST_MEMBER_type(attr) = type;
02021 if (is_declaration)
02022 DST_SET_declaration(flag);
02023 else {
02024 DST_MEMBER_memb_loc(attr) = memb_loc;
02025 DST_MEMBER_byte_size(attr) = byte_size;
02026 DST_MEMBER_bit_offset(attr) = bit_offset;
02027 DST_MEMBER_bit_size(attr) = bit_size;
02028 if (is_bitfield)
02029 DST_SET_bitfield(flag);
02030 }
02031 if (is_static)
02032 DST_SET_static(flag);
02033 if (is_artificial)
02034 DST_SET_artificial(flag);
02035 #ifdef KEY
02036 DST_MEMBER_accessibility(attr) = accessibility;
02037 #endif
02038 return DST_init_info(info_idx, DW_TAG_member, flag, attr_idx);
02039 }
02040
02041
02042
02043
02044 #ifndef KEY
02045 DST_INFO_IDX
02046 DST_mk_inheritance(USRCPOS decl,
02047 DST_INFO_IDX type,
02048 DST_virtuality virtuality,
02049 DST_size_t memb_loc)
02050 #else
02051 DST_INFO_IDX
02052 DST_mk_inheritance(USRCPOS decl,
02053 DST_INFO_IDX type,
02054 DST_virtuality virtuality,
02055 DST_size_t memb_loc,
02056 DST_accessibility accessibility)
02057 #endif
02058 {
02059 DST_INFO_IDX info_idx;
02060 DST_ATTR_IDX attr_idx;
02061 DST_flag flag = DST_no_flag;
02062 DST_INHERITANCE *attr;
02063
02064 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02065 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02066 #endif
02067
02068 info_idx = DST_mk_info();
02069 attr_idx = DST_mk_attr(DST_INHERITANCE);
02070 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_INHERITANCE);
02071 DST_INHERITANCE_decl(attr) = decl;
02072 DST_INHERITANCE_type(attr) = type;
02073 DST_INHERITANCE_virtuality(attr) = virtuality;
02074 DST_INHERITANCE_memb_loc(attr) = memb_loc;
02075 #ifdef KEY
02076 DST_INHERITANCE_accessibility(attr) = accessibility;
02077 #endif
02078 return DST_init_info(info_idx, DW_TAG_inheritance, flag, attr_idx);
02079 }
02080
02081
02082
02083
02084 extern DST_INFO_IDX
02085 DST_mk_template_type_parameter(USRCPOS decl,
02086 char *name,
02087 DST_INFO_IDX type)
02088 {
02089 DST_INFO_IDX info_idx;
02090 DST_ATTR_IDX attr_idx;
02091 DST_flag flag = DST_no_flag;
02092 DST_TEMPLATE_TYPE_PARAMETER *attr;
02093
02094 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02095 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02096 #endif
02097
02098 info_idx = DST_mk_info();
02099 attr_idx = DST_mk_attr(DST_TEMPLATE_TYPE_PARAMETER);
02100 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_TEMPLATE_TYPE_PARAMETER);
02101 DST_TEMPLATE_TYPE_PARAMETER_decl(attr) = decl;
02102 DST_TEMPLATE_TYPE_PARAMETER_name(attr) = DST_mk_name(name);
02103 DST_TEMPLATE_TYPE_PARAMETER_type(attr) = type;
02104 return DST_init_info(info_idx, DW_TAG_template_type_param,
02105 flag, attr_idx);
02106 }
02107
02108
02109
02110
02111 extern DST_INFO_IDX
02112 DST_mk_template_value_parameter(USRCPOS decl,
02113 char *name,
02114 DST_INFO_IDX type,
02115 DST_CONST_VALUE cval)
02116 {
02117 DST_INFO_IDX info_idx;
02118 DST_ATTR_IDX attr_idx;
02119 DST_flag flag = DST_no_flag;
02120 DST_TEMPLATE_VALUE_PARAMETER *attr;
02121
02122 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02123 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02124 #endif
02125
02126 info_idx = DST_mk_info();
02127 attr_idx = DST_mk_attr(DST_TEMPLATE_VALUE_PARAMETER);
02128 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_TEMPLATE_VALUE_PARAMETER);
02129 DST_TEMPLATE_VALUE_PARAMETER_decl(attr) = decl;
02130 DST_TEMPLATE_VALUE_PARAMETER_name(attr) = DST_mk_name(name);
02131 DST_TEMPLATE_VALUE_PARAMETER_cval(attr) = cval;
02132 DST_TEMPLATE_VALUE_PARAMETER_type(attr) = type;
02133 return DST_init_info(info_idx, DW_TAG_template_value_param,
02134 flag, attr_idx);
02135 }
02136
02137
02138
02139
02140
02141 DST_INFO_IDX
02142 DST_mk_enumeration_type(USRCPOS decl,
02143 char *name,
02144 DST_size_t byte_size,
02145 DST_INFO_IDX abstract_origin,
02146 BOOL is_incomplete)
02147 {
02148 DST_INFO_IDX info_idx;
02149 DST_ATTR_IDX attr_idx;
02150 DST_flag flag = DST_no_flag;
02151 DST_ENUMERATION_TYPE *attr;
02152
02153 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02154 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02155 #endif
02156
02157 info_idx = DST_mk_info();
02158 attr_idx = DST_mk_attr(DST_ENUMERATION_TYPE);
02159 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_ENUMERATION_TYPE);
02160 DST_ENUMERATION_TYPE_decl(attr) = decl;
02161 DST_ENUMERATION_TYPE_name(attr) = DST_mk_name(name);
02162 DST_ENUMERATION_TYPE_byte_size(attr) = byte_size;
02163 DST_ENUMERATION_TYPE_abstract_origin(attr) = abstract_origin;
02164 DST_ENUMERATION_TYPE_first_child(attr) = DST_INVALID_IDX;
02165 DST_ENUMERATION_TYPE_last_child(attr) = DST_INVALID_IDX;
02166 if (is_incomplete)
02167 DST_SET_declaration(flag);
02168 return DST_init_info(info_idx, DW_TAG_enumeration_type, flag, attr_idx);
02169 }
02170
02171
02172
02173
02174 DST_INFO_IDX
02175 DST_mk_enumerator(USRCPOS decl,
02176 char *name,
02177 DST_CONST_VALUE cval)
02178 {
02179 DST_INFO_IDX info_idx;
02180 DST_ATTR_IDX attr_idx;
02181 DST_flag flag = DST_no_flag;
02182 DST_ENUMERATOR *attr;
02183
02184 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02185 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02186 #endif
02187
02188 info_idx = DST_mk_info();
02189 attr_idx = DST_mk_attr(DST_ENUMERATOR);
02190 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_ENUMERATOR);
02191 DST_ENUMERATOR_decl(attr) = decl;
02192 DST_ENUMERATOR_name(attr) = DST_mk_name(name);
02193 DST_ENUMERATOR_cval(attr) = cval;
02194 return DST_init_info(info_idx, DW_TAG_enumerator, flag, attr_idx);
02195 }
02196
02197
02198
02199
02200 DST_INFO_IDX
02201 DST_mk_subroutine_type(USRCPOS decl,
02202 char *name,
02203 DST_INFO_IDX type,
02204 DST_INFO_IDX abstract_origin,
02205 BOOL is_prototyped)
02206 {
02207 DST_INFO_IDX info_idx;
02208 DST_ATTR_IDX attr_idx;
02209 DST_flag flag = DST_no_flag;
02210 DST_SUBROUTINE_TYPE *attr;
02211
02212 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02213 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02214 #endif
02215
02216 info_idx = DST_mk_info();
02217 attr_idx = DST_mk_attr(DST_SUBROUTINE_TYPE);
02218 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_SUBROUTINE_TYPE);
02219 DST_SUBROUTINE_TYPE_decl(attr) = decl;
02220 DST_SUBROUTINE_TYPE_name(attr) = DST_mk_name(name);
02221 DST_SUBROUTINE_TYPE_type(attr) = type;
02222 DST_SUBROUTINE_TYPE_abstract_origin(attr) = abstract_origin;
02223 DST_SUBROUTINE_TYPE_first_child(attr) = DST_INVALID_IDX;
02224 DST_SUBROUTINE_TYPE_last_child(attr) = DST_INVALID_IDX;
02225 if (is_prototyped)
02226 DST_SET_prototyped(flag);
02227 return DST_init_info(info_idx, DW_TAG_subroutine_type, flag, attr_idx);
02228 }
02229
02230 #ifdef KEY
02231
02232
02233 DST_INFO_IDX
02234 DST_mk_namelist(USRCPOS decl,
02235 char *name)
02236 {
02237 DST_INFO_IDX info_idx;
02238 DST_ATTR_IDX attr_idx;
02239 DST_flag flag = DST_no_flag;
02240 DST_NAMELIST *attr;
02241
02242 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02243 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02244 #endif
02245
02246 info_idx = DST_mk_info();
02247 attr_idx = DST_mk_attr(DST_NAMELIST);
02248 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_NAMELIST);
02249 DST_NAMELIST_decl(attr) = decl;
02250 DST_NAMELIST_name(attr) = DST_mk_name(name);
02251 DST_NAMELIST_first_child(attr) = DST_INVALID_IDX;
02252 DST_NAMELIST_last_child(attr) = DST_INVALID_IDX;
02253 return DST_init_info(info_idx, DW_TAG_namelist, flag, attr_idx);
02254 }
02255
02256
02257
02258 DST_INFO_IDX
02259 DST_mk_namelist_item(USRCPOS decl,
02260 char *name)
02261 {
02262 DST_INFO_IDX info_idx;
02263 DST_ATTR_IDX attr_idx;
02264 DST_flag flag = DST_no_flag;
02265 DST_NAMELIST_ITEM *attr;
02266
02267 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02268 DST_enter_mk(DST_making_dbg_info, last_info_idx);
02269 #endif
02270
02271 info_idx = DST_mk_info();
02272 attr_idx = DST_mk_attr(DST_NAMELIST_ITEM);
02273 attr = DST_ATTR_IDX_TO_PTR(attr_idx, DST_NAMELIST_ITEM);
02274 DST_NAMELIST_ITEM_decl(attr) = decl;
02275 DST_NAMELIST_ITEM_name(attr) = DST_mk_name(name);
02276 return DST_init_info(info_idx, DW_TAG_namelist_item, flag, attr_idx);
02277 }
02278
02279
02280
02281 DST_MACR_IDX
02282 DST_mk_macr (UINT lineno,
02283 char *macro,
02284 INT tag )
02285 {
02286 DST_MACR *m_ptr, *prev_ptr;
02287 DST_MACR_IDX m_idx;
02288
02289
02290 if (DST_IS_NULL(last_macro))
02291 {
02292 DST_begin_block(DST_macro_info_block);
02293 pstate = DST_making_macinfo;
02294 }
02295 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02296 else
02297 DST_enter_mk(DST_making_macinfo, last_macro);
02298 #endif
02299
02300
02301 m_idx = DST_mk_macro();
02302 m_ptr = DST_MACR_IDX_TO_PTR(m_idx);
02303 DST_MACR_macro(m_ptr) = DST_mk_string(macro);
02304 DST_MACR_lineno(m_ptr) = lineno;
02305 DST_MACR_tag(m_ptr) = tag;
02306 DST_MACR_next(m_ptr) = DST_INVALID_IDX;
02307 if (!DST_IS_NULL(last_macro))
02308 {
02309 prev_ptr = DST_MACR_IDX_TO_PTR(last_macro);
02310 DST_MACR_next(prev_ptr) = m_idx;
02311 }
02312 last_macro = m_idx;
02313 num_macros += 1;
02314 return m_idx;
02315 }
02316
02317
02318
02319 DST_MACR_IDX
02320 DST_mk_macr_start_file (UINT lineno,
02321 UINT fileno )
02322 {
02323 DST_MACR *m_ptr, *prev_ptr;
02324 DST_MACR_IDX m_idx;
02325
02326
02327 if (DST_IS_NULL(last_macro))
02328 {
02329 DST_begin_block(DST_macro_info_block);
02330 pstate = DST_making_macinfo;
02331 }
02332 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02333 else
02334 DST_enter_mk(DST_making_macinfo, last_macro);
02335 #endif
02336
02337
02338 m_idx = DST_mk_macro();
02339 m_ptr = DST_MACR_IDX_TO_PTR(m_idx);
02340 DST_MACR_lineno(m_ptr) = lineno;
02341 DST_MACR_fileno(m_ptr) = fileno;
02342 DST_MACR_tag(m_ptr) = DW_MACINFO_start_file;
02343 DST_MACR_next(m_ptr) = DST_INVALID_IDX;
02344 if (!DST_IS_NULL(last_macro))
02345 {
02346 prev_ptr = DST_MACR_IDX_TO_PTR(last_macro);
02347 DST_MACR_next(prev_ptr) = m_idx;
02348 }
02349 last_macro = m_idx;
02350 num_macros += 1;
02351 return m_idx;
02352 }
02353
02354
02355
02356 DST_MACR_IDX
02357 DST_mk_macr_end_file (void)
02358 {
02359 DST_MACR *m_ptr, *prev_ptr;
02360 DST_MACR_IDX m_idx;
02361
02362
02363 if (DST_IS_NULL(last_macro))
02364 {
02365 DST_begin_block(DST_macro_info_block);
02366 pstate = DST_making_macinfo;
02367 }
02368 #if !(defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER))
02369 else
02370 DST_enter_mk(DST_making_macinfo, last_macro);
02371 #endif
02372
02373
02374 m_idx = DST_mk_macro();
02375 m_ptr = DST_MACR_IDX_TO_PTR(m_idx);
02376 DST_MACR_tag(m_ptr) = DW_MACINFO_end_file;
02377 DST_MACR_next(m_ptr) = DST_INVALID_IDX;
02378 if (!DST_IS_NULL(last_macro))
02379 {
02380 prev_ptr = DST_MACR_IDX_TO_PTR(last_macro);
02381 DST_MACR_next(prev_ptr) = m_idx;
02382 }
02383 last_macro = m_idx;
02384 num_macros += 1;
02385 return m_idx;
02386 }
02387 #endif