Skip to content

Commit 693f24c

Browse files
committed
gdbtool: keep photon_init/fini/fr/rst with same feature
1 parent 1b38e26 commit 693f24c

2 files changed

Lines changed: 264 additions & 76 deletions

File tree

thread/thread.cpp

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,63 +2255,34 @@ R"(
22552255
// GDB Python script reads: gdb.parse_and_eval("gdb_offsets")
22562256
// =========================================================================
22572257

2258-
// All offsets in a single struct for easy access
22592258
extern "C" const struct {
22602259
// Version number for compatibility checking
22612260
// Increment when adding/removing/modifying/reordering offset fields
2262-
uint32_t version;
2263-
uint32_t _reserved; // Padding for alignment
2261+
uint32_t version = 1;
2262+
uint32_t _reserved = 0; // Padding for alignment
22642263

22652264
// Thread structure
2266-
size_t thread_size;
2267-
size_t thread_offset_prev;
2268-
size_t thread_offset_next;
2269-
size_t thread_offset_vcpu;
2270-
size_t thread_offset_stack_ptr;
2271-
size_t thread_offset_idx;
2272-
size_t thread_offset_error_number;
2273-
size_t thread_offset_waitq;
2274-
size_t thread_offset_flags;
2275-
size_t thread_offset_state;
2276-
size_t thread_offset_ts_wakeup;
2277-
size_t thread_offset_tls;
2278-
size_t thread_offset_buf;
2279-
size_t thread_offset_stack_size;
2265+
size_t thread_size = sizeof(photon::thread);
2266+
size_t thread_offset_prev = 0;
2267+
size_t thread_offset_next = sizeof(void*);
2268+
size_t thread_offset_vcpu = offsetof(photon::thread, vcpu);
2269+
size_t thread_offset_stack_ptr = offsetof(photon::thread, stack);
2270+
size_t thread_offset_idx = offsetof(photon::thread, idx);
2271+
size_t thread_offset_error_number = offsetof(photon::thread, error_number);
2272+
size_t thread_offset_waitq = offsetof(photon::thread, waitq);
2273+
size_t thread_offset_flags = offsetof(photon::thread, flags);
2274+
size_t thread_offset_state = offsetof(photon::thread, state);
2275+
size_t thread_offset_ts_wakeup = offsetof(photon::thread, ts_wakeup);
2276+
size_t thread_offset_tls = offsetof(photon::thread, tls);
2277+
size_t thread_offset_buf = offsetof(photon::thread, buf);
2278+
size_t thread_offset_stack_size = offsetof(photon::thread, stack_size);
22802279

22812280
// vCPU structure
2282-
size_t vcpu_size;
2283-
size_t vcpu_offset_sleepq;
2284-
size_t vcpu_offset_nthreads;
2285-
size_t vcpu_offset_idle_worker;
2286-
size_t vcpu_offset_standbyq;
2287-
size_t vcpu_offset_list_node_prev;
2288-
size_t vcpu_offset_list_node_next;
2289-
} gdb_offsets = {
2290-
1, // version
2291-
0, // _reserved
2292-
2293-
// Thread structure
2294-
sizeof(photon::thread),
2295-
0,
2296-
sizeof(void*),
2297-
offsetof(photon::thread, vcpu),
2298-
offsetof(photon::thread, stack),
2299-
offsetof(photon::thread, idx),
2300-
offsetof(photon::thread, error_number),
2301-
offsetof(photon::thread, waitq),
2302-
offsetof(photon::thread, flags),
2303-
offsetof(photon::thread, state),
2304-
offsetof(photon::thread, ts_wakeup),
2305-
offsetof(photon::thread, tls),
2306-
offsetof(photon::thread, buf),
2307-
offsetof(photon::thread, stack_size),
2308-
2309-
// vCPU structure
2310-
sizeof(photon::vcpu_t),
2311-
offsetof(photon::vcpu_t, sleepq),
2312-
offsetof(photon::vcpu_t, nthreads),
2313-
offsetof(photon::vcpu_t, idle_worker),
2314-
offsetof(photon::vcpu_t, standbyq),
2315-
offsetof(photon::vcpu_t, __prev_ptr),
2316-
offsetof(photon::vcpu_t, __next_ptr),
2317-
};
2281+
size_t vcpu_size = sizeof(photon::vcpu_t);
2282+
size_t vcpu_offset_sleepq = offsetof(photon::vcpu_t, sleepq);
2283+
size_t vcpu_offset_nthreads = offsetof(photon::vcpu_t, nthreads);
2284+
size_t vcpu_offset_idle_worker = offsetof(photon::vcpu_t, idle_worker);
2285+
size_t vcpu_offset_standbyq = offsetof(photon::vcpu_t, standbyq);
2286+
size_t vcpu_offset_list_node_prev = offsetof(photon::vcpu_t, __prev_ptr);
2287+
size_t vcpu_offset_list_node_next = offsetof(photon::vcpu_t, __next_ptr);
2288+
} gdb_offsets;

0 commit comments

Comments
 (0)