-
Notifications
You must be signed in to change notification settings - Fork 170
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
gdbremote: Initial (and minimal) support for remote debugging #444
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,17 @@ linux_kernel_get_initial_registers_aarch64(const struct drgn_object *task_obj, | |
return NULL; | ||
} | ||
|
||
static struct drgn_error * | ||
gdbremote_get_initial_registers_aarch64(struct drgn_program *prog, | ||
const void *regs, size_t reglen, | ||
struct drgn_register_state **ret) | ||
{ | ||
// gdbremote uses the same binary format as struct user_pt_reg | ||
// so we can just reuse that code. | ||
Comment on lines
+237
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that true in general or only for some architectures? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to admit I'm not entirely sure. kgdb uses lookup tables to convert from gdb format to struct (plain, ordinary, not-user) pt_reg. Hopefully we do that for a reason although I haven't, as yet, gone digging to find out why. |
||
return get_initial_registers_from_struct_aarch64(prog, regs, reglen, | ||
ret); | ||
} | ||
|
||
static struct drgn_error * | ||
apply_elf_reloc_aarch64(const struct drgn_relocating_section *relocating, | ||
uint64_t r_offset, uint32_t r_type, const int64_t *r_addend, | ||
|
@@ -495,6 +506,7 @@ const struct drgn_architecture_info arch_info_aarch64 = { | |
.prstatus_get_initial_registers = prstatus_get_initial_registers_aarch64, | ||
.linux_kernel_get_initial_registers = | ||
linux_kernel_get_initial_registers_aarch64, | ||
.gdbremote_get_initial_registers = gdbremote_get_initial_registers_aarch64, | ||
.apply_elf_reloc = apply_elf_reloc_aarch64, | ||
.linux_kernel_pgtable_iterator_create = | ||
linux_kernel_pgtable_iterator_create_aarch64, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll likely also want to support serial devices and Unix socket domain sockets natively in the future. This interface should still be sufficient, since we could differentiate by:
conn
starts with/
or.
, it must be a path, and we can check whether the path is a socket or a character device.conn
looks like ahost:port
, assume it is a TCP connection. If a user has a path that looks like ahost:port
, they can prefix it with./
to disambiguate it.(Nothing for you to act on here, I'm just thinking ahead.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to double check but gdb's heuristic looks even simpler than that!