From 7ffc52e056086379515a56a1e45881be0d2695f5 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 2 Jan 2006 20:41:28 +0000 Subject: [PATCH] backport r5470 from trunk: r5470 | sewardj | 2006-01-02 00:00:49 +0100 (Mon, 02 Jan 2006) | 5 lines Read dwarf2 line number information even if a .debug_str section was not found. This is believed to fix the regression in 3.1.X wherein debug info was sometimes not read from icc-8.1 generated executables. git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_1_BRANCH@5479 --- coregrind/m_debuginfo/dwarf.c | 11 ++++++++--- coregrind/m_debuginfo/symtab.c | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/coregrind/m_debuginfo/dwarf.c b/coregrind/m_debuginfo/dwarf.c index 457c86275f..143d77ff72 100644 --- a/coregrind/m_debuginfo/dwarf.c +++ b/coregrind/m_debuginfo/dwarf.c @@ -847,9 +847,14 @@ void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, /* Those cases extract the data properly */ case 0x05: /* FORM_data2 */ cval = *((UShort*)p); p +=2; break; case 0x06: /* FORM_data4 */ cval = *((UInt*)p);p +=4; break; - case 0x0e: /* FORM_strp */ sval = debugstr + *((UInt*)p); - p += 4; break; - /* pointer in .debug_str */ + case 0x0e: /* FORM_strp */ /* pointer in .debug_str */ + /* 2006-01-01: only generate a value if + debugstr is non-NULL (which means that a + debug_str section was found) */ + if (debugstr) + sval = debugstr + *((UInt*)p); + p += 4; + break; case 0x08: /* FORM_string */ sval = (Char*)p; p += VG_(strlen)((Char*)p) + 1; break; case 0x0b: /* FORM_data1 */ cval = *p; p++; break; diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c index a92685f2d2..594448c1d7 100644 --- a/coregrind/m_debuginfo/symtab.c +++ b/coregrind/m_debuginfo/symtab.c @@ -1727,7 +1727,12 @@ Bool read_lib_symbols ( SegInfo* si ) stabstr, stabstr_sz ); } # endif - if (debug_info && debug_abbv && debug_line && debug_str) { + /* jrs 2006-01-01: icc-8.1 has been observed to generate + binaries without debug_str sections. Don't preclude + debuginfo reading for that reason, but, in + read_unitinfo_dwarf2, do check that debugstr is non-NULL + before using it. */ + if (debug_info && debug_abbv && debug_line /* && debug_str */) { ML_(read_debuginfo_dwarf2) ( si, debug_info, debug_info_sz, debug_abbv, -- 2.47.2