@@ -105,6 +105,9 @@ namespace ddprof {
105105DDRes unwind_init_dwfl (UnwindState *us) {
106106 // Create or get the dwfl object associated to cache
107107 us->_dwfl_wrapper = &(us->dwfl_hdr .get_or_insert (us->pid ));
108+ // clear at every iteration
109+ us->symbol_hdr ._austin_symbol_lookup .clear ();
110+
108111 if (!us->_dwfl_wrapper ->_attached ) {
109112 // we need to add at least one module to figure out the architecture (to
110113 // create the unwinding backend)
@@ -404,7 +407,6 @@ static DDRes add_python_frame(UnwindState *us, SymbolIdx_t symbol_idx,
404407 ElfAddress_t pc, Dwfl_Frame *dwfl_frame) {
405408 SymbolHdr &unwind_symbol_hdr = us->symbol_hdr ;
406409 SymbolTable &symbol_table = unwind_symbol_hdr._symbol_table ;
407-
408410 std::string symname = symbol_table.at (symbol_idx)._symname ;
409411 if (us->austin_handle &&
410412 (symname.find (" PyEval_EvalFrameDefault" ) != std::string::npos ||
@@ -413,11 +415,11 @@ static DDRes add_python_frame(UnwindState *us, SymbolIdx_t symbol_idx,
413415 unwind_symbol_hdr._austin_symbol_lookup ;
414416
415417 // The register we are interested in is RSI, but it doesn't seem to be
416- // available. So we loop over the first 64 registers and stop if we find
418+ // available. So we loop over the available registers and stop if we find
417419 // a register value that resolves correctly to a Python frame.
418- uint64_t val;
419- for (int i = 0 ; i < ( int ) sizeof (*dwfl_frame-> regs_set ) * 8 ; i++) {
420- if (__libdwfl_frame_reg_get (dwfl_frame, i, &val)) {
420+ uint64_t val = 0 ;
421+ for (int i = 0 ; i < PERF_REGS_COUNT ; i++) {
422+ if (__libdwfl_frame_reg_get (dwfl_frame, i, &val) && val ) {
421423 austin_frame_t *frame =
422424 austin_read_frame (us->austin_handle , (void *)val);
423425 if (frame) {
0 commit comments