Skip to content
New issue

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

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

Already on GitHub? # to your account

Add: Generate Coredump - added support for threads and x86 #5104

Merged
merged 2 commits into from
Jun 9, 2016

Conversation

leberus
Copy link
Contributor

@leberus leberus commented Jun 9, 2016

I've added support for threads and x86 systems to the "generate coredump" feature.
I've also cleaned up all debug stuff and tried to refactor as much code as possible.

It's still missing some minor checks like:

  • if the system does not offer a proc_coredump_filter (because the kernel is old enough) just take the default value (0x33)
  • if kernel offers process_vm_readv, use it because it's much faster than io r/w
  • some other improvments I can't think about them right now.

Once this is passed, i'll put my hands on "load coredumps"

static bool dump_this_map(char *buff_smaps, ut64 start_addr, ut64 end_addr, bool file_backed, bool anonymous, ut8 perms, ut8 filter_flags) {
char *p, *pp, *ppp, *extern_tok, *flags_str;
char *identity = NULL;
static bool dump_this_map(char *buff_smaps, unsigned long start_addr, unsigned long end_addr,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function signatures must fit in one line, do not indent like this. if you feel this function is having too many parameters groups them in a struct for info and use only modifiers as arguments, or another struct if there are many arguments.

This is how rust handles default parameters and variable argument functions. and it makes the function signatures more readable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K&R syntax solved this in a sugar way, which doesnt reduces the number of arguments, but drops type definitions from the signature line.

@radare radare merged commit 6b1a46b into radareorg:master Jun 9, 2016
@radare radare added this to the 0.10.4 milestone Jun 9, 2016
@radare
Copy link
Collaborator

radare commented Jun 9, 2016

The patch looks good so far. i just added few syntax comments for future enhancements.. It will be awesome if you could port this to ARM, MIPS and POWERPC. I guess that ARM is the only one that really matters, but i dont think porting this to other archs would be difficult as only the register state will differ.

@radare
Copy link
Collaborator

radare commented Jun 9, 2016

About the core-loading thing, i implemented a bit of it for mach0 and elf, it shows an arw line that must be copypasted into the r2 prompt to set the register state, so the user can read the stack and position of RIP/EIP when the crash happened.

It will be good not to have to copypaste the arw line. I have tested it and it works on arm and x86 at least (on linux cores)

@leberus
Copy link
Contributor Author

leberus commented Jun 10, 2016

Hi! Yeah, I tohough about port it to ARM and to other archs, but right now it's quite difficult because I'm on vacation and I don't have so many devices here, but once I'm back I'll work on it.
I'll also take a look at what you did on core-loading feature because is something I'd like to fully implement.

I'll come back once I have something ;)

@radare
Copy link
Collaborator

radare commented Jun 10, 2016

👍

On 10 Jun 2016, at 09:18, leberus notifications@github.com wrote:

Hi! Yeah, I tohough about port it to ARM and to other archs, but right now it's quite difficult because I'm on vacation and I don't have so many devices here, but once I'm back I'll work on it.
I'll also take a look at what you did on core-loading feature because is something I'd like to fully implement.

I'll come back once I have something ;)


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@leberus leberus mentioned this pull request Jul 4, 2016
2 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants