Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Wozniski <[email protected]>
Signed-off-by: Pablo Galindo Salgado <[email protected]>
  • Loading branch information
pablogsal and godlygeek authored Jun 5, 2024
1 parent 12149cd commit 3deea72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pystack/_pystack/cpython/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ typedef struct _is
int _initialized;
int _ready;
int finalizing;
uint64_t last_restart_version;
uintptr_t last_restart_version;
struct pythreads
{
uint64_t next_unique_id;
_pythreadstate* head;
_pythreadstate* main;
long count;
Py_ssize_t count;
size_t stacksize;
} threads;
struct pyruntimestate* runtime;
Expand Down
2 changes: 1 addition & 1 deletion src/pystack/_pystack/cpython/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ typedef struct pyruntimestate

struct pyinterpreters
{
PyThread_type_lock mutex;
PyMutex mutex;
PyInterpreterState* head;
PyInterpreterState* main;
int64_t next_id;
Expand Down
5 changes: 2 additions & 3 deletions src/pystack/_pystack/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,13 @@ AbstractProcessManager::Pid() const
remote_addr_t
AbstractProcessManager::getAddressFromCache(const std::string& symbol) const
{
return d_symbol_cache[symbol];
return d_type_cache[symbol];
}

void
AbstractProcessManager::registerAddressInCache(const std::string& symbol, remote_addr_t address) const
{
d_symbol_cache[symbol] = address;
return;
d_type_cache[symbol] = address;
}

std::string
Expand Down
5 changes: 3 additions & 2 deletions src/pystack/_pystack/pyframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ FrameObject::getCode(

uintptr_t last_instruction;
if (manager->versionIsAtLeast(3, 13)) {
// In 3.13, the field is really called *instr_ptr*, but we are reusing the same
// field name as in 3.12 to avoid having to change the code in multiple places.
// In 3.13 the field is called *instr_ptr* and points to the current instruction
// rather than the previous one. We're reusing the same name and adjusting the
// value to allow us to use the same decoding code across versions.
uintptr_t inst_ptr = manager->getField(frame, &py_frame_v::o_prev_instr);
last_instruction = inst_ptr - sizeof(Python3_12::_Py_CODEUNIT*);
} else if (manager->versionIsAtLeast(3, 11)) {
Expand Down

0 comments on commit 3deea72

Please sign in to comment.