From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: Jim Blandy , gdb-patches@sources.redhat.com Subject: [PATCH RFA] partial-stab.h patch amendment Date: Wed, 05 Sep 2001 15:43:00 -0000 Message-id: <1010905224331.ZM6026@ocotillo.lan> X-SW-Source: 2001-09/msg00046.html The patch below is an amendment to the partial-stab.h patch that I submitted earlier in the week: http://sources.redhat.com/ml/gdb-patches/2001-09/msg00003.html In the above patch, I added some code which tests the return value of find_stab_function_addr() to make sure that we're not attempting to use a result which indicates an error condition. However, there are actually two calls to find_stab_function_addr() in partial-stab.h. One is used to determine the address of global function symbols (when this information is not provided in the debug info) and the other is used to help set textlow for static function symbols. I added code to test the return value for the global function symbol case. In a conversation with Jim Blandy earlier today, he made two observations: 1) The call to find_stab_function_addr() should be error checked in both cases. 2) We probably ought to be using the same mechanism to set CUR_SYMBOL_VALUE for the static function case as well as the global. The patch below addresses both of these points. * partial-stab.h (case 'f'): Make SOFUN_ADDRESS_MAYBE_MISSING code match that used for case 'F'. diff -u -p -r1.12 partial-stab.h --- partial-stab.h 2001/08/15 05:02:28 1.12 +++ partial-stab.h 2001/09/05 21:35:30 @@ -595,10 +595,22 @@ switch (CUR_SYMBOL_TYPE) #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit value for the bottom of the text seg in those cases. */ - if (pst && textlow_not_set) + if (CUR_SYMBOL_VALUE == ANOFFSET (objfile->section_offsets, + SECT_OFF_TEXT (objfile))) { - pst->textlow = + CORE_ADDR minsym_valu = find_stab_function_addr (namestring, pst->filename, objfile); + /* find_stab_function_addr will return 0 if the minimal + symbol wasn't found. (Unfortunately, this might also + be a valid address.) Anyway, if it *does* return 0, + it is likely that the value was set correctly to begin + with... */ + if (minsym_valu != 0) + CUR_SYMBOL_VALUE = minsym_valu; + } + if (pst && textlow_not_set) + { + pst->textlow = CUR_SYMBOL_VALUE; textlow_not_set = 0; } #endif