Skip to content

Commit f8d102f

Browse files
committed
Python frames
- Avoid ending profiling when non utf8 strings are found - Other fixups to investigate libaustin issue
1 parent 27fecbc commit f8d102f

File tree

15 files changed

+32
-18
lines changed

15 files changed

+32
-18
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ target_link_libraries(dd_profiling-embedded PUBLIC dl pthread rt)
267267
# add libaustin
268268
add_library(austin SHARED IMPORTED)
269269
set_target_properties(
270-
austin PROPERTIES IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/lib/libaustin.a"
270+
austin PROPERTIES IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/lib_debug/libaustin.a"
271271
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libaustin")
272272

273273
set(LIBDD_PROFILING_EMBEDDED_OBJECT "${CMAKE_BINARY_DIR}/libdd_profiling-embedded.o")

app/base-env/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,17 @@ RUN pip3 install cmake_format
165165

166166
RUN apt-get update \
167167
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
168-
libtool
168+
libtool \
169+
libiberty-dev
169170

170-
RUN git clone --branch r1viollet/libaustin https://github.com/r1viollet/austin.git && \
171+
172+
# possibly useful command
173+
# CFLAGS="-g -O0 -DTRACE" ./configure
174+
# Valid commit : git checkout a7a292b3f5a1058051b017c0d339a678efdec704
175+
RUN git clone --branch r1viollet/libaustin_v2 https://github.com/r1viollet/austin.git && \
171176
cd austin && \
172177
autoreconf --install && \
173-
./configure && \
178+
CFLAGS="-g -O0 -DTRACE" ./configure && \
174179
make && \
175180
make install
176181

include/ddprof_process.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Process {
3636
// lazy read of container id
3737
const ContainerId &get_container_id(std::string_view path_to_proc = "");
3838

39-
austin_handle_t get_austin_handle();
39+
austin_handle_t get_austin_handle(pid_t tid);
4040

4141
uint64_t _sample_counter = {};
4242

include/symbol.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Symbol {
2121
Symbol(std::string symname, std::string demangle_name, uint32_t lineno,
2222
std::string srcpath)
2323
: _symname(std::move(symname)), _demangle_name(std::move(demangle_name)),
24-
_lineno(lineno), _srcpath(std::move(srcpath)) {}
24+
_lineno(lineno), _srcpath(std::move(srcpath)), _is_python_frame(false) {}
2525

2626
// OUTPUT OF ADDRINFO
2727
std::string _symname;

include/unwind.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void unwind_init(void);
1616

1717
// Fill sample info to prepare for unwinding
1818
void unwind_init_sample(UnwindState *us, uint64_t *sample_regs,
19-
pid_t sample_pid, uint64_t sample_size_stack,
19+
pid_t sample_pid, pid_t sample_tid, uint64_t sample_size_stack,
2020
char *sample_data_stack);
2121

2222
// Main unwind API

include/unwind_state.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct UnwindState {
5454
ddprof::ProcessHdr process_hdr;
5555

5656
pid_t pid;
57+
pid_t tid;
5758
char *stack;
5859
size_t stack_sz;
5960

lib/libaustin.so

-97.3 KB
Binary file not shown.

lib_debug/libaustin.a

104 KB
Binary file not shown.

src/ddprof_process.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ Process::~Process() {
2727
}
2828
}
2929

30-
austin_handle_t Process::get_austin_handle() {
30+
austin_handle_t Process::get_austin_handle(pid_t tid) {
3131
if (!_austin_handle) {
32+
LG_NTC("Attaching to PID %d/%d", _pid, tid);
3233
_austin_handle = austin_attach(_pid);
34+
LG_NTC("Result of attach %p", _austin_handle);
3335
}
3436
return _austin_handle;
3537
}

src/ddprof_worker.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static DDRes ddprof_unwind_sample(DDProfContext *ctx, perf_event_sample *sample,
233233
ddprof_stats_add(STATS_UNWIND_AVG_STACK_SIZE, sample->size_stack, nullptr);
234234

235235
// copy the sample context into the unwind structure
236-
unwind_init_sample(us, sample->regs, sample->pid, sample->size_stack,
236+
unwind_init_sample(us, sample->regs, sample->pid, sample->tid, sample->size_stack,
237237
sample->data_stack);
238238

239239
// If a sample has a PID, it has a TID. Include it for downstream labels

0 commit comments

Comments
 (0)