2 * File hash.c - generate hash tables for Wine debugger symbols
4 * Copyright (C) 1993, Eric Youngdale.
13 #include <sys/types.h>
16 #define NR_NAME_HASH 16384
18 #define PATH_MAX _MAX_PATH
22 static char * reg_name[] =
24 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
27 static unsigned reg_ofs[] =
29 FIELD_OFFSET(CONTEXT, Eax), FIELD_OFFSET(CONTEXT, Ecx),
30 FIELD_OFFSET(CONTEXT, Edx), FIELD_OFFSET(CONTEXT, Ebx),
31 FIELD_OFFSET(CONTEXT, Esp), FIELD_OFFSET(CONTEXT, Ebp),
32 FIELD_OFFSET(CONTEXT, Esi), FIELD_OFFSET(CONTEXT, Edi)
35 static char * reg_name[] = { NULL }; /* FIXME */
36 static unsigned reg_ofs[] = { 0 };
42 struct name_hash * next; /* Used to look up within name hash */
48 WineLocals * local_vars;
56 unsigned short breakpoint_offset;
57 unsigned int symbol_size;
61 static BOOL DEBUG_GetStackSymbolValue( const char * name, DBG_VALUE *value );
62 static int sortlist_valid = FALSE;
64 static int sorttab_nsym;
65 static struct name_hash ** addr_sorttab = NULL;
67 static struct name_hash * name_hash_table[NR_NAME_HASH];
69 static unsigned int name_hash( const char * name )
71 unsigned int hash = 0;
79 hash = (hash << 4) + *p++;
81 if( (tmp = (hash & 0xf0000000)) )
87 return hash % NR_NAME_HASH;
91 DEBUG_cmp_sym(const void * p1, const void * p2)
93 struct name_hash ** name1 = (struct name_hash **) p1;
94 struct name_hash ** name2 = (struct name_hash **) p2;
96 if( ((*name1)->flags & SYM_INVALID) != 0 )
101 if( ((*name2)->flags & SYM_INVALID) != 0 )
106 if( (*name1)->value.addr.seg > (*name2)->value.addr.seg )
111 if( (*name1)->value.addr.seg < (*name2)->value.addr.seg )
116 if( (*name1)->value.addr.off > (*name2)->value.addr.off )
121 if( (*name1)->value.addr.off < (*name2)->value.addr.off )
129 /***********************************************************************
130 * DEBUG_ResortSymbols
132 * Rebuild sorted list of symbols.
136 DEBUG_ResortSymbols(void)
138 struct name_hash *nh;
142 for(i=0; i<NR_NAME_HASH; i++)
144 for (nh = name_hash_table[i]; nh; nh = nh->next)
146 if( (nh->flags & SYM_INVALID) == 0 )
149 DEBUG_Printf( DBG_CHN_MESG, "Symbol %s is invalid\n", nh->name );
159 addr_sorttab = (struct name_hash **) DBG_realloc(addr_sorttab,
160 nsym * sizeof(struct name_hash *));
163 for(i=0; i<NR_NAME_HASH; i++)
165 for (nh = name_hash_table[i]; nh; nh = nh->next)
167 if( (nh->flags & SYM_INVALID) == 0 )
168 addr_sorttab[nsym++] = nh;
172 qsort(addr_sorttab, nsym,
173 sizeof(struct name_hash *), DEBUG_cmp_sym);
174 sortlist_valid = TRUE;
178 /***********************************************************************
181 * Add a symbol to the table.
184 DEBUG_AddSymbol( const char * name, const DBG_VALUE *value, const char * source,
187 struct name_hash * new;
188 struct name_hash *nh;
189 static char prev_source[PATH_MAX] = {'\0', };
190 static char * prev_duped_source = NULL;
194 assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
196 hash = name_hash(name);
197 for (nh = name_hash_table[hash]; nh; nh = nh->next)
199 if( ((nh->flags & SYM_INVALID) != 0) && strcmp(name, nh->name) == 0 )
202 DEBUG_Printf(DBG_CHN_MESG, "Changing address for symbol %s (%08lx:%08lx => %08lx:%08lx)\n",
203 name, nh->value.addr.seg, nh->value.addr.off, value->addr.seg, value->addr.off);
205 nh->value.addr = value->addr;
207 if( nh->value.type == NULL && value->type != NULL )
209 nh->value.type = value->type;
210 nh->value.cookie = value->cookie;
212 /* it may happen that the same symbol is defined in several compilation
213 * units, but the linker decides to merge it into a single instance.
214 * in that case, we don't clear the invalid flag for all the compilation
215 * units (N_GSYM), and wait to get the symbol from the symtab
217 if ((flags & SYM_INVALID) == 0)
218 nh->flags &= ~SYM_INVALID;
222 if (nh->value.addr.seg == value->addr.seg &&
223 nh->value.addr.off == value->addr.off &&
224 strcmp(name, nh->name) == 0 )
231 DEBUG_Printf(DBG_CHN_TRACE, "adding symbol (%s) from file '%s' at 0x%04lx:%08lx\n",
232 name, source, value->addr.seg, value->addr.off);
236 * First see if we already have an entry for this symbol. If so
237 * return it, so we don't end up with duplicates.
240 new = (struct name_hash *) DBG_alloc(sizeof(struct name_hash));
242 new->name = DBG_strdup(name);
247 * This is an enhancement to reduce memory consumption. The idea
248 * is that we duplicate a given string only once. This is a big
249 * win if there are lots of symbols defined in a given source file.
251 if( strcmp(source, prev_source) == 0 )
253 new->sourcefile = prev_duped_source;
257 strcpy(prev_source, source);
258 prev_duped_source = new->sourcefile = DBG_strdup(source);
263 new->sourcefile = NULL;
267 new->lines_alloc = 0;
271 new->locals_alloc = 0;
272 new->local_vars = NULL;
277 /* Now insert into the hash table */
278 new->next = name_hash_table[hash];
279 name_hash_table[hash] = new;
282 * Check some heuristics based upon the file name to see whether
283 * we want to step through this guy or not. These are machine generated
284 * assembly files that are used to translate between the MS way of
285 * calling things and the GCC way of calling things. In general we
286 * always want to step through.
290 c = strrchr(source, '.');
291 if( c != NULL && strcmp(c, ".s") == 0 )
293 c = strrchr(source, '/');
297 if( (strcmp(c, "callfrom16.s") == 0)
298 || (strcmp(c, "callto16.s") == 0)
299 || (strcmp(c, "call32.s") == 0) )
301 new->flags |= SYM_TRAMPOLINE;
307 sortlist_valid = FALSE;
311 BOOL DEBUG_Normalize(struct name_hash * nh )
315 * We aren't adding any more locals or linenumbers to this function.
316 * Free any spare memory that we might have allocated.
323 if( nh->n_locals != nh->locals_alloc )
325 nh->locals_alloc = nh->n_locals;
326 nh->local_vars = DBG_realloc(nh->local_vars,
327 nh->locals_alloc * sizeof(WineLocals));
330 if( nh->n_lines != nh->lines_alloc )
332 nh->lines_alloc = nh->n_lines;
333 nh->linetab = DBG_realloc(nh->linetab,
334 nh->lines_alloc * sizeof(WineLineNo));
340 /***********************************************************************
341 * DEBUG_GetSymbolValue
343 * Get the address of a named symbol.
345 BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
346 DBG_VALUE *value, int bp_flag )
349 struct name_hash *nh;
351 for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
353 if( (nh->flags & SYM_INVALID) != 0 )
358 if (!strcmp(nh->name, name)) break;
361 if (!nh && (name[0] != '_'))
364 strcpy(buffer+1, name);
365 for(nh = name_hash_table[name_hash(buffer)]; nh; nh = nh->next)
367 if( (nh->flags & SYM_INVALID) != 0 )
371 if (!strcmp(nh->name, buffer)) break;
376 * If we don't have anything here, then try and see if this
377 * is a local symbol to the current stack frame. No matter
378 * what, we have nothing more to do, so we let that function
379 * decide what we ultimately return.
383 return DEBUG_GetStackSymbolValue(name, value);
386 value->type = nh->value.type;
387 value->cookie = nh->value.cookie;
388 return DEBUG_GetLineNumberAddr( nh, lineno, &value->addr, bp_flag );
391 /***********************************************************************
392 * DEBUG_GetLineNumberAddr
394 * Get the address of a named symbol.
396 BOOL DEBUG_GetLineNumberAddr( struct name_hash * nh, const int lineno,
397 DBG_ADDR *addr, int bp_flag )
403 *addr = nh->value.addr;
406 addr->off += nh->breakpoint_offset;
412 * Search for the specific line number. If we don't find it,
415 if( nh->linetab == NULL )
420 for(i=0; i < nh->n_lines; i++ )
422 if( nh->linetab[i].line_number == lineno )
424 *addr = nh->linetab[i].pc_offset;
430 * This specific line number not found.
439 /***********************************************************************
440 * DEBUG_SetSymbolValue
442 * Set the address of a named symbol.
444 BOOL DEBUG_SetSymbolValue( const char * name, const DBG_VALUE *value )
447 struct name_hash *nh;
449 assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
451 for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
452 if (!strcmp(nh->name, name)) break;
454 if (!nh && (name[0] != '_'))
457 strcpy(buffer+1, name);
458 for(nh = name_hash_table[name_hash(buffer)]; nh; nh = nh->next)
459 if (!strcmp(nh->name, buffer)) break;
462 if (!nh) return FALSE;
464 nh->flags &= ~SYM_INVALID;
467 DEBUG_FixAddress( &nh->value.addr, DEBUG_context.SegDs );
474 /***********************************************************************
475 * DEBUG_FindNearestSymbol
477 * Find the symbol nearest to a given address.
478 * If ebp is specified as non-zero, it means we should dump the argument
479 * list into the string we return as well.
481 const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
482 struct name_hash ** rtn,
484 struct list_id * source)
486 static char name_buffer[MAX_PATH + 256];
487 static char arglist[1024];
488 static char argtmp[256];
489 struct name_hash * nearest = NULL;
493 char * lineinfo, *sourcefile;
505 source->sourcefile = NULL;
509 if( sortlist_valid == FALSE )
511 DEBUG_ResortSymbols();
514 if( sortlist_valid == FALSE )
520 * FIXME - use the binary search that we added to
521 * the function DEBUG_CheckLinenoStatus. Better yet, we should
522 * probably keep some notion of the current function so we don't
523 * have to search every time.
526 * Binary search to find closest symbol.
530 if( addr_sorttab[0]->value.addr.seg > addr->seg
531 || ( addr_sorttab[0]->value.addr.seg == addr->seg
532 && addr_sorttab[0]->value.addr.off > addr->off) )
536 else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg
537 || ( addr_sorttab[high - 1]->value.addr.seg == addr->seg
538 && addr_sorttab[high - 1]->value.addr.off < addr->off) )
540 nearest = addr_sorttab[high - 1];
546 mid = (high + low)/2;
550 * See if there are any other entries that might also
551 * have the same address, and would also have a line
554 if( mid > 0 && addr_sorttab[mid]->linetab == NULL )
556 if( (addr_sorttab[mid - 1]->value.addr.seg ==
557 addr_sorttab[mid]->value.addr.seg)
558 && (addr_sorttab[mid - 1]->value.addr.off ==
559 addr_sorttab[mid]->value.addr.off)
560 && (addr_sorttab[mid - 1]->linetab != NULL) )
566 if( (mid < sorttab_nsym - 1)
567 && (addr_sorttab[mid]->linetab == NULL) )
569 if( (addr_sorttab[mid + 1]->value.addr.seg ==
570 addr_sorttab[mid]->value.addr.seg)
571 && (addr_sorttab[mid + 1]->value.addr.off ==
572 addr_sorttab[mid]->value.addr.off)
573 && (addr_sorttab[mid + 1]->linetab != NULL) )
578 nearest = addr_sorttab[mid];
580 DEBUG_Printf(DBG_CHN_MESG, "Found %x:%x when looking for %x:%x %x %s\n",
581 addr_sorttab[mid ]->value.addr.seg,
582 addr_sorttab[mid ]->value.addr.off,
583 addr->seg, addr->off,
584 addr_sorttab[mid ]->linetab,
585 addr_sorttab[mid ]->name);
589 if( (addr_sorttab[mid]->value.addr.seg < addr->seg)
590 || ( addr_sorttab[mid]->value.addr.seg == addr->seg
591 && addr_sorttab[mid]->value.addr.off <= addr->off) )
602 if (!nearest) return NULL;
610 * Fill in the relevant bits to the structure so that we can
611 * locate the source and line for this bit of code.
615 source->sourcefile = nearest->sourcefile;
616 if( nearest->linetab == NULL )
622 source->line = nearest->linetab[0].line_number;
630 * Prepare to display the argument list. If ebp is specified, it is
631 * the framepointer for the function in question. If not specified,
632 * we don't want the arglist.
634 memset(arglist, '\0', sizeof(arglist));
637 for(i=0; i < nearest->n_locals; i++ )
640 * If this is a register (offset == 0) or a local
641 * variable, we don't want to know about it.
643 if( nearest->local_vars[i].offset <= 0 )
648 ptr = (unsigned int *) (ebp + nearest->local_vars[i].offset);
649 if( arglist[0] == '\0' )
655 strcat(arglist, ", ");
657 DEBUG_READ_MEM_VERBOSE(ptr, &val, sizeof(val));
658 sprintf(argtmp, "%s=0x%x", nearest->local_vars[i].name, val);
660 strcat(arglist, argtmp);
662 if( arglist[0] == '(' )
664 strcat(arglist, ")");
668 if( (nearest->sourcefile != NULL) && (flag == TRUE)
669 && (addr->off - nearest->value.addr.off < 0x100000) )
673 * Try and find the nearest line number to the current offset.
675 if( nearest->linetab != NULL )
678 high = nearest->n_lines;
679 while ((high - low) > 1)
681 mid = (high + low) / 2;
682 if (addr->off < nearest->linetab[mid].pc_offset.off)
687 lineno = nearest->linetab[low].line_number;
692 sprintf(linebuff, ":%d", lineno);
696 source->line = lineno;
700 /* Remove the path from the file name */
701 sourcefile = strrchr( nearest->sourcefile, '/' );
702 if (!sourcefile) sourcefile = nearest->sourcefile;
705 if (addr->off == nearest->value.addr.off)
706 sprintf( name_buffer, "%s%s [%s%s]", nearest->name,
707 arglist, sourcefile, lineinfo);
709 sprintf( name_buffer, "%s+0x%lx%s [%s%s]", nearest->name,
710 addr->off - nearest->value.addr.off,
711 arglist, sourcefile, lineinfo );
715 if (addr->off == nearest->value.addr.off)
716 sprintf( name_buffer, "%s%s", nearest->name, arglist);
718 if (addr->seg && (nearest->value.addr.seg!=addr->seg))
721 sprintf( name_buffer, "%s+0x%lx%s", nearest->name,
722 addr->off - nearest->value.addr.off, arglist);
729 /***********************************************************************
730 * DEBUG_ReadSymbolTable
732 * Read a symbol file into the hash table.
734 void DEBUG_ReadSymbolTable( const char * filename )
743 if (!(symbolfile = fopen(filename, "r")))
745 DEBUG_Printf( DBG_CHN_WARN, "Unable to open symbol table %s\n", filename );
749 DEBUG_Printf( DBG_CHN_MESG, "Reading symbols from file %s\n", filename );
754 value.cookie = DV_TARGET;
758 fgets( buffer, sizeof(buffer), symbolfile );
759 if (feof(symbolfile)) break;
761 /* Strip any text after a # sign (i.e. comments) */
764 if(*cpnt++ == '#') { *cpnt = 0; break; }
766 /* Quietly ignore any lines that have just whitespace */
770 if(*cpnt != ' ' && *cpnt != '\t') break;
773 if (!(*cpnt) || *cpnt == '\n') continue;
775 if (sscanf(buffer, "%lx %c %s", &value.addr.off, &type, name) == 3)
776 DEBUG_AddSymbol( name, &value, NULL, SYM_WINE );
783 DEBUG_AddLineNumber( struct name_hash * func, int line_num,
784 unsigned long offset )
791 if( func->n_lines + 1 >= func->lines_alloc )
793 func->lines_alloc += 64;
794 func->linetab = DBG_realloc(func->linetab,
795 func->lines_alloc * sizeof(WineLineNo));
798 func->linetab[func->n_lines].line_number = line_num;
799 func->linetab[func->n_lines].pc_offset.seg = func->value.addr.seg;
800 func->linetab[func->n_lines].pc_offset.off = func->value.addr.off + offset;
806 DEBUG_AddLocal( struct name_hash * func, int regno,
817 if( func->n_locals + 1 >= func->locals_alloc )
819 func->locals_alloc += 32;
820 func->local_vars = DBG_realloc(func->local_vars,
821 func->locals_alloc * sizeof(WineLocals));
824 func->local_vars[func->n_locals].regno = regno;
825 func->local_vars[func->n_locals].offset = offset;
826 func->local_vars[func->n_locals].pc_start = pc_start;
827 func->local_vars[func->n_locals].pc_end = pc_end;
828 func->local_vars[func->n_locals].name = DBG_strdup(name);
829 func->local_vars[func->n_locals].type = NULL;
832 return &func->local_vars[func->n_locals - 1];
836 DEBUG_DumpHashInfo(void)
840 struct name_hash *nh;
843 * Utility function to dump stats about the hash table.
845 for(i=0; i<NR_NAME_HASH; i++)
848 for (nh = name_hash_table[i]; nh; nh = nh->next)
852 DEBUG_Printf(DBG_CHN_MESG, "Bucket %d: %d\n", i, depth);
856 /***********************************************************************
857 * DEBUG_CheckLinenoStatus
859 * Find the symbol nearest to a given address.
860 * If ebp is specified as non-zero, it means we should dump the argument
861 * list into the string we return as well.
863 int DEBUG_CheckLinenoStatus( const DBG_ADDR *addr)
865 struct name_hash * nearest = NULL;
868 if( sortlist_valid == FALSE )
870 DEBUG_ResortSymbols();
874 * Binary search to find closest symbol.
878 if( addr_sorttab[0]->value.addr.seg > addr->seg
879 || ( addr_sorttab[0]->value.addr.seg == addr->seg
880 && addr_sorttab[0]->value.addr.off > addr->off) )
884 else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg
885 || ( addr_sorttab[high - 1]->value.addr.seg == addr->seg
886 && addr_sorttab[high - 1]->value.addr.off < addr->off) )
888 nearest = addr_sorttab[high - 1];
894 mid = (high + low)/2;
898 * See if there are any other entries that might also
899 * have the same address, and would also have a line
902 if( mid > 0 && addr_sorttab[mid]->linetab == NULL )
904 if( (addr_sorttab[mid - 1]->value.addr.seg ==
905 addr_sorttab[mid]->value.addr.seg)
906 && (addr_sorttab[mid - 1]->value.addr.off ==
907 addr_sorttab[mid]->value.addr.off)
908 && (addr_sorttab[mid - 1]->linetab != NULL) )
914 if( (mid < sorttab_nsym - 1)
915 && (addr_sorttab[mid]->linetab == NULL) )
917 if( (addr_sorttab[mid + 1]->value.addr.seg ==
918 addr_sorttab[mid]->value.addr.seg)
919 && (addr_sorttab[mid + 1]->value.addr.off ==
920 addr_sorttab[mid]->value.addr.off)
921 && (addr_sorttab[mid + 1]->linetab != NULL) )
926 nearest = addr_sorttab[mid];
928 DEBUG_Printf(DBG_CHN_MESG, "Found %x:%x when looking for %x:%x %x %s\n",
929 addr_sorttab[mid ]->value.addr.seg,
930 addr_sorttab[mid ]->value.addr.off,
931 addr->seg, addr->off,
932 addr_sorttab[mid ]->linetab,
933 addr_sorttab[mid ]->name);
937 if( (addr_sorttab[mid]->value.addr.seg < addr->seg)
938 || ( addr_sorttab[mid]->value.addr.seg == addr->seg
939 && addr_sorttab[mid]->value.addr.off <= addr->off) )
950 if (!nearest) return FUNC_HAS_NO_LINES;
952 if( nearest->flags & SYM_STEP_THROUGH )
955 * This will cause us to keep single stepping until
956 * we get to the other side somewhere.
958 return NOT_ON_LINENUMBER;
961 if( (nearest->flags & SYM_TRAMPOLINE) )
964 * This will cause us to keep single stepping until
965 * we get to the other side somewhere.
967 return FUNC_IS_TRAMPOLINE;
970 if( nearest->linetab == NULL )
972 return FUNC_HAS_NO_LINES;
977 * We never want to stop on the first instruction of a function
978 * even if it has it's own linenumber. Let the thing keep running
979 * until it gets past the function prologue. We only do this if there
980 * is more than one line number for the function, of course.
982 if( nearest->value.addr.off == addr->off && nearest->n_lines > 1 )
984 return NOT_ON_LINENUMBER;
987 if( (nearest->sourcefile != NULL)
988 && (addr->off - nearest->value.addr.off < 0x100000) )
991 high = nearest->n_lines;
992 while ((high - low) > 1)
994 mid = (high + low) / 2;
995 if (addr->off < nearest->linetab[mid].pc_offset.off) high = mid;
998 if (addr->off == nearest->linetab[low].pc_offset.off)
999 return AT_LINENUMBER;
1001 return NOT_ON_LINENUMBER;
1004 return FUNC_HAS_NO_LINES;
1007 /***********************************************************************
1010 * Find the symbol nearest to a given address.
1011 * Returns sourcefile name and line number in a format that the listing
1012 * handler can deal with.
1015 DEBUG_GetFuncInfo( struct list_id * ret, const char * filename,
1020 struct name_hash *nh;
1022 for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
1024 if( filename != NULL )
1027 if( nh->sourcefile == NULL )
1032 pnt = strrchr(nh->sourcefile, '/');
1033 if( strcmp(nh->sourcefile, filename) != 0
1034 && (pnt == NULL || strcmp(pnt + 1, filename) != 0) )
1039 if (!strcmp(nh->name, name)) break;
1042 if (!nh && (name[0] != '_'))
1045 strcpy(buffer+1, name);
1046 for(nh = name_hash_table[name_hash(buffer)]; nh; nh = nh->next)
1048 if( filename != NULL )
1050 if( nh->sourcefile == NULL )
1055 pnt = strrchr(nh->sourcefile, '/');
1056 if( strcmp(nh->sourcefile, filename) != 0
1057 && (pnt == NULL || strcmp(pnt + 1, filename) != 0) )
1062 if (!strcmp(nh->name, buffer)) break;
1068 if( filename != NULL )
1070 DEBUG_Printf(DBG_CHN_MESG, "No such function %s in %s\n", name, filename);
1074 DEBUG_Printf(DBG_CHN_MESG, "No such function %s\n", name);
1076 ret->sourcefile = NULL;
1081 ret->sourcefile = nh->sourcefile;
1084 * Search for the specific line number. If we don't find it,
1085 * then return FALSE.
1087 if( nh->linetab == NULL )
1093 ret->line = nh->linetab[0].line_number;
1097 /***********************************************************************
1098 * DEBUG_GetStackSymbolValue
1100 * Get the address of a named symbol from the current stack frame.
1103 BOOL DEBUG_GetStackSymbolValue( const char * name, DBG_VALUE *value )
1105 struct name_hash * curr_func;
1110 if( DEBUG_GetCurrentFrame(&curr_func, &eip, &ebp) == FALSE )
1115 for(i=0; i < curr_func->n_locals; i++ )
1118 * Test the range of validity of the local variable. This
1119 * comes up with RBRAC/LBRAC stabs in particular.
1121 if( (curr_func->local_vars[i].pc_start != 0)
1122 && ((eip - curr_func->value.addr.off)
1123 < curr_func->local_vars[i].pc_start) )
1128 if( (curr_func->local_vars[i].pc_end != 0)
1129 && ((eip - curr_func->value.addr.off)
1130 > curr_func->local_vars[i].pc_end) )
1135 if( strcmp(name, curr_func->local_vars[i].name) == 0 )
1138 * OK, we found it. Now figure out what to do with this.
1140 if( curr_func->local_vars[i].regno != 0 )
1143 * Register variable. Point to DEBUG_context field.
1145 assert(curr_func->local_vars[i].regno - 1 < sizeof(reg_ofs)/sizeof(reg_ofs[0]));
1146 value->addr.off = ((DWORD)&DEBUG_context) +
1147 reg_ofs[curr_func->local_vars[i].regno - 1];
1148 value->cookie = DV_HOST;
1152 value->addr.off = ebp + curr_func->local_vars[i].offset;
1153 value->cookie = DV_TARGET;
1155 value->addr.seg = 0;
1156 value->type = curr_func->local_vars[i].type;
1166 DEBUG_InfoLocals(void)
1168 struct name_hash * curr_func;
1175 if( DEBUG_GetCurrentFrame(&curr_func, &eip, &ebp) == FALSE )
1180 for(i=0; i < curr_func->n_locals; i++ )
1183 * Test the range of validity of the local variable. This
1184 * comes up with RBRAC/LBRAC stabs in particular.
1186 if( (curr_func->local_vars[i].pc_start != 0)
1187 && ((eip - curr_func->value.addr.off)
1188 < curr_func->local_vars[i].pc_start) )
1193 if( (curr_func->local_vars[i].pc_end != 0)
1194 && ((eip - curr_func->value.addr.off)
1195 > curr_func->local_vars[i].pc_end) )
1200 if( curr_func->local_vars[i].regno != 0 )
1202 ptr = (unsigned int *)(((DWORD)&DEBUG_context)
1203 + reg_ofs[curr_func->local_vars[i].regno - 1]);
1204 DEBUG_Printf(DBG_CHN_MESG, "%s:%s (optimized into register $%s) == 0x%8.8x\n",
1205 curr_func->name, curr_func->local_vars[i].name,
1206 reg_name[curr_func->local_vars[i].regno - 1],
1211 DEBUG_READ_MEM_VERBOSE((void*)(ebp + curr_func->local_vars[i].offset),
1213 DEBUG_Printf(DBG_CHN_MESG, "%s:%s == 0x%8.8x\n",
1214 curr_func->name, curr_func->local_vars[i].name, val);
1222 DEBUG_SetSymbolSize(struct name_hash * sym, unsigned int len)
1224 sym->symbol_size = len;
1230 DEBUG_SetSymbolBPOff(struct name_hash * sym, unsigned int off)
1232 sym->breakpoint_offset = off;
1238 DEBUG_GetSymbolAddr(struct name_hash * sym, DBG_ADDR * addr)
1241 *addr = sym->value.addr;
1246 int DEBUG_SetLocalSymbolType(struct wine_locals * sym, struct datatype * type)