mirror of
https://github.com/flutter/samples.git
synced 2026-08-25 01:21:59 +00:00
Minor updates for release 3.47 ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`). If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md [changelog]: ../CHANGELOG.md --------- Co-authored-by: Parker Lougheed <parlough@gmail.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
#
|
|
# Generated file, do not edit.
|
|
#
|
|
|
|
import lldb
|
|
|
|
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
|
|
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
|
|
base = frame.register["x0"].GetValueAsAddress()
|
|
page_len = frame.register["x1"].GetValueAsUnsigned()
|
|
|
|
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
|
|
# first page to see if handled it correctly. This makes diagnosing
|
|
# misconfiguration (e.g. missing breakpoint) easier.
|
|
data = bytearray(page_len)
|
|
data[0:8] = b'IHELPED!'
|
|
|
|
error = lldb.SBError()
|
|
frame.GetThread().GetProcess().WriteMemory(base, data, error)
|
|
if not error.Success():
|
|
print(f'Failed to write into {base}[+{page_len}]', error)
|
|
return
|
|
|
|
def __lldb_init_module(debugger: lldb.SBDebugger, _):
|
|
target = debugger.GetDummyTarget()
|
|
# Caveat: must use BreakpointCreateByRegEx here and not
|
|
# BreakpointCreateByName. For some reasons callback function does not
|
|
# get carried over from dummy target for the later.
|
|
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
|
|
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
|
|
bp.SetAutoContinue(True)
|
|
print("-- LLDB integration loaded --")
|