Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attach: Work around a bug in old gdb versions #310

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmarks/benchmarking/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def remove_outliers(values, m=2):


def plot_diff_pair(ax, ref, head, names, outlier_rejection=True):

master_data = []
all_data = []
means = []
Expand Down
1 change: 1 addition & 0 deletions news/310.bugfix.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Work around `a bug in GDB versions before 10.1 <https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=da1df1db9ae43050c8de62e4842428ddda7eb509>`_ that could cause ``memray attach`` to fail.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def announce_and_run(self, command, **kwargs):
subprocess.run(command, check=True, **kwargs)

def build_libbacktrace(self):

archive_location = LIBBACKTRACE_LIBDIR / "libbacktrace.a"

if archive_location.exists():
Expand Down
2 changes: 1 addition & 1 deletion src/memray/commands/_attach.gdb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ b PyMem_Calloc
b PyMem_Realloc
b PyMem_Free
# Apply commands to all 8 breakpoints above
commands 1 2 3 4 5 6 7 8
commands 1-8
disable breakpoints
call (void*)dlopen($libpath, $rtld_now)
p (char*)dlerror()
Expand Down
1 change: 0 additions & 1 deletion src/memray/reporters/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class SummaryReporter:

N_COLUMNS = len(TUI.KEY_TO_COLUMN_NAME)

def __init__(self, data: Iterable[AllocationRecord], native: bool):
Expand Down
1 change: 0 additions & 1 deletion src/memray/reporters/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def from_snapshot(
memory_records: Iterable[MemorySnapshot],
native_traces: bool,
) -> "TableReporter":

result = []
for record in allocations:
stack_trace = (
Expand Down
2 changes: 0 additions & 2 deletions src/memray/reporters/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def render_as_gprof2dot(
outfile: TextIO,
**kwargs: Any,
) -> None:

location_to_index: Dict[Location, int] = {}
all_locations: List[Dict[str, str]] = []
events = []
Expand Down Expand Up @@ -87,7 +86,6 @@ def render_as_csv(
outfile: TextIO,
**kwargs: Any,
) -> None:

writer = csv.writer(outfile)
writer.writerow(
[
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ def test_report_both_temporary_allocation_arguments(

class TestLiveRemoteSubcommand:
def test_live_tracking(self, tmp_path, simple_test_file, free_port):

# GIVEN
server = subprocess.Popen(
[
Expand Down Expand Up @@ -1165,7 +1164,6 @@ def test_live_tracking_server_exits_properly_on_sigint(self, simple_test_file):
assert b"Interrupted system call" not in stderr

def test_live_client_exits_properly_on_sigint_before_connecting(self, free_port):

# GIVEN
client = subprocess.Popen(
[
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,6 @@ def test_leaks_that_happen_in_different_lines(self, tmp_path, file_format):
def test_leaks_that_happen_in_the_same_function_are_aggregated(
self, tmp_path, file_format
):

# GIVEN
allocators = []
output = tmp_path / "test.bin"
Expand Down Expand Up @@ -1172,7 +1171,6 @@ def test_unmatched_deallocations_are_not_reported(self, tmp_path, file_format):
)

def test_thread_allocations_multiple_threads(self, tmpdir, file_format):

# GIVEN
def allocating_function(allocator, amount, stop_flag):
allocator.posix_memalign(amount)
Expand Down Expand Up @@ -1352,7 +1350,6 @@ def test_temporary_allocations_that_happen_in_different_lines(self, tmp_path):
def test_temporary_allocations_that_happen_in_the_same_function_are_aggregated(
self, tmp_path
):

# GIVEN
output = tmp_path / "test.bin"

Expand Down Expand Up @@ -1400,7 +1397,6 @@ def test_unmatched_allocations_are_not_reported(self, tmp_path):
)

def test_thread_allocations_multiple_threads(self, tmpdir):

# GIVEN
def allocating_function(allocator, amount, stop_flag):
allocator.posix_memalign(amount)
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_tui_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class TestTUIHeader:
],
)
def test_pid(self, pid, out_str):

# GIVEN
snapshot = []
output = StringIO()
Expand Down Expand Up @@ -107,7 +106,6 @@ def test_too_long_command_line_is_trimmed(self):
assert actual == expected

def test_with_no_allocations(self):

# GIVEN
snapshot = []
output = StringIO()
Expand Down