diff options
author | Josh Stone <jistone@redhat.com> | 2009-06-09 08:54:59 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-06-09 08:55:11 -0700 |
commit | 5e8208c0c3012c3f2b0215385c2b02422c2e4769 (patch) | |
tree | 33e3445fe6f6de93c2a9a876e5ba6dd50aa165b8 /tapsets.cxx | |
parent | ad002306b50c6cc3c3601fac31dfe3ecf23749fb (diff) | |
download | systemtap-steved-5e8208c0c3012c3f2b0215385c2b02422c2e4769.tar.gz systemtap-steved-5e8208c0c3012c3f2b0215385c2b02422c2e4769.tar.xz systemtap-steved-5e8208c0c3012c3f2b0215385c2b02422c2e4769.zip |
Fix uninitialized shdr in probe_table
(redo commit 3d022fa9c6bdbca383dfc639d08d65287c708f56)
* tapsets.cxx (dwarf_builder::probe_table::probe_table): gcc 4.4
complains that shdr may be used uninitialized. I added returns to
ensure that it's ok, but gcc still complains. Set the thing to NULL
as well to silence the beast.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index b684adc2..4b8d9a13 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -689,7 +689,7 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s { Elf* elf; GElf_Shdr shdr_mem; - GElf_Shdr *shdr; + GElf_Shdr *shdr = NULL; Dwarf_Addr bias; size_t shstrndx; @@ -713,6 +713,9 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s break; } } + + if (!have_probes) + return; // Older versions put .probes section in the debuginfo dwarf file, // so check if it actually exists, if not take the main elf file @@ -721,6 +724,7 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s elf = dwfl_module_getelf (dw->module, &bias); dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx)); probe_scn = NULL; + have_probes = false; while ((probe_scn = elf_nextscn (elf, probe_scn))) { shdr = gelf_getshdr (probe_scn, &shdr_mem); @@ -731,6 +735,9 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s } } + if (!have_probes) + return; + pdata = elf_getdata_rawchunk (elf, shdr->sh_offset, shdr->sh_size, ELF_T_BYTE); probe_scn_offset = 0; probe_scn_addr = shdr->sh_addr; |