{"action":"created","comment":{"url":"https://api.github.com/repos/radare/radare2/pulls/comments/64011304","id":64011304,"diff_hunk":"@@ -517,3 +521,1439 @@ RList *linux_desc_list (int pid) {\n \tclosedir (dd);\n \treturn ret;\n }\n+\n+\n+/* Coredump  functions */\n+\n+static map_file_t mapping_file = {0,0};\n+\n+static char *prpsinfo_get_fname(char *buffer) {\n+\tchar *p;\n+\t\n+\t/* buffer contains: str\\0str1\\0str2\\0... Here we're only interested in the first part of string, and strdup copies till it reaches a \\0 */\n+\tp = strdup (buffer);\n+\treturn p;\n+}\n+\n+static char *get_basename(char *pfname, int len) {\n+\tchar *p;\n+\n+\tfor (p = pfname + len; p != pfname ; p--) {\n+\t\tif (*p == '/') return (p + 1);\n+\t}\n+\n+\treturn p;\n+}\n+\n+static char *prpsinfo_get_psargs(char *buffer, char *pfname, int size_psargs, int len) {\n+\tchar paux[ELF_PRARGSZ];\n+\tchar *p;\n+\tint i;\n+\tint bytes_left;\n+\n+\tp = r_mem_dup (pfname, size_psargs);\n+\tif (!p) return NULL;\n+\n+\tbytes_left = strlen (pfname);\n+\tbuffer = strchr (buffer, '\\0');\n+\n+\tfor(i = 0; i + bytes_left < len && i + bytes_left < (size_psargs - 1); i++) {\n+\t\tif (buffer[i] == '\\0') buffer[i] = ' ';\n+\t\tpaux[i] = buffer[i];\n+\t}\n+\n+\tpaux[i] = '\\0';\n+\tstrncat (p, paux, size_psargs - bytes_left - 1);\n+\n+\treturn p;\n+}\n+\n+static void debug_print_prpsinfo(prpsinfo_t *p) {\n+\teprintf (\"prpsinfo.pr_state: %d\\n\", p->pr_state);\n+\teprintf (\"prpsinfo.pr_sname: %c\\n\", p->pr_sname);\n+\teprintf (\"prpsinfo.pr_zomb: %d\\n\", p->pr_zomb);\n+\teprintf (\"prpsinfo.pr_nice: %d\\n\", p->pr_nice);\n+\teprintf (\"prpsinfo.pr_flags: %ld\\n\", p->pr_flag);\n+\teprintf (\"prpsinfo.pr_uid: %d\\n\", p->pr_uid);\n+\teprintf (\"prpsinfo.pr_gid: %d\\n\", p->pr_gid);\n+\teprintf (\"prpsinfo.pr_pid: %d\\n\", p->pr_pid);\n+\teprintf (\"prpsinfo.pr_ppid: %d\\n\", p->pr_ppid);\n+\teprintf (\"prpsinfo.pr_pgrp: %d\\n\", p->pr_pgrp);\n+\teprintf (\"prpsinfo.pr_sid: %d\\n\", p->pr_sid);\n+\teprintf (\"prpsinfo.pr_fname: %s\\n\", p->pr_fname);\n+\teprintf (\"prpsinfo.pr_psargs: %s\\n\", p->pr_psargs);\n+}\n+\n+static prpsinfo_t *linux_get_prpsinfo(RDebug *dbg, proc_stat_content_t *proc_data) {\n+\tchar file[128];\n+\tint len;\n+\tpid_t mypid;\n+\tchar *buffer;\n+\tchar *pfname;\n+\tchar *ppsargs;\n+\tchar *basename; /* pr_fname stores just the exec, withouth the path */\n+\tconst char prog_states[] = \"RSDTZW\";\t\t\t\t/* fs/binfmt_elf.c from kernel */\n+\tprpsinfo_t *p;\n+\n+\tpfname = ppsargs = basename = NULL;\n+\n+\tp = R_NEW0 (prpsinfo_t);\n+\tif (!p) {\n+\t\teprintf (\"Couldn't allocate memory for prpsinfo_t\\n\");\n+\t\treturn NULL;\n+\t}\n+\n+\tp->pr_pid = mypid = dbg->pid;\n+\n+\t/* Start filling pr_fname and pr_psargs */\n+\tsnprintf (file, sizeof(file), \"/proc/%d/cmdline\", mypid);\n+\teprintf (\"r_file_slurp\\n\");\n+\tbuffer = r_file_slurp (file, &len);\n+\tif (!buffer) {\n+\t\teprintf (\"buffer NULL\\n\");\n+\t\treturn NULL;\n+\t}\n+\t\n+\tbuffer = r_file_slurp (file, &len);\n+\tpfname = prpsinfo_get_fname (buffer);\t\n+\tif (!pfname) {\n+\t\teprintf (\"prpsinfo_get_fname: couldn't allocate memory\\n\");\n+\t\tgoto error;\n+\t}\n+\t\n+\tbasename = get_basename (pfname, strlen(pfname));\n+\tstrncpy (p->pr_fname, basename, sizeof(p->pr_fname));\n+\n+\tppsargs = prpsinfo_get_psargs (buffer, pfname, sizeof(p->pr_psargs), len);\n+\tif (!ppsargs) {\n+\t\teprintf (\"prpsinfo_get_psargs: couldn't allocate memory\\n\");\n+\t\treturn NULL;\n+\t}\n+\n+\tstrncpy (p->pr_psargs, ppsargs, sizeof(p->pr_psargs));\n+\tfree (buffer);\n+\tfree (ppsargs);\n+\tfree (pfname);\n+\t\n+\tp->pr_sname = proc_data->s_name;\n+\tp->pr_zomb = (p->pr_sname == 'Z') ? 1 : 0;\n+\tp->pr_state = strchr (prog_states, p->pr_sname) - prog_states;\n+\tp->pr_ppid = proc_data->ppid;\n+\tp->pr_pgrp = proc_data->pgrp;\n+\tp->pr_sid = proc_data->sid;\n+\tp->pr_flag = proc_data->flag;\n+\tp->pr_nice = proc_data->nice;\n+\tp->pr_uid = proc_data->uid;\n+\tp->pr_gid = proc_data->gid;\n+\t\n+\tdebug_print_prpsinfo(p);\n+\teprintf (\"linux_get_prpsinfo: end\\n\");\n+\n+\treturn p;\n+\n+\terror:\n+\t\tfree (p);\n+\t\tfree (buffer);\n+\t\tfree (pfname);\n+\t\tfree (ppsargs);\n+\n+\t\treturn NULL;\n+}\n+\n+void debug_prstatus(prstatus_t *p) {\n+\teprintf(\"\\n== debug_prstatus ==\\n\");\n+\teprintf(\"p->pr_cursig: %d\\n\", p->pr_cursig);\n+\teprintf(\"p->pr_info.si_signo: %d\\n\", p->pr_info.si_signo);\n+\teprintf(\"p->pr_pid: %d\\n\", p->pr_pid);\n+\teprintf(\"p->pr_ppid: %d\\n\", p->pr_ppid);\n+\teprintf(\"p->pr_pgrp: %d\\n\", p->pr_pgrp);\n+\teprintf(\"p->pr_sid: %d\\n\", p->pr_sid);\n+\teprintf(\"p->pr_sigpend: %ld\\n\", p->pr_sigpend);\n+\teprintf(\"p->pr_sighold: %ld\\n\", p->pr_sighold);\n+}\n+\n+static prstatus_t *linux_get_prstatus(RDebug *dbg, proc_stat_content_t *proc_data, short int signr) {\n+\tprstatus_t *p;\n+\tut8 *reg_buff;\n+\tint rbytes;\n+\tsize_t size_gp_regset;\n+\n+\treg_buff = R_NEW0 (struct user_regs_struct);\n+\tif (!reg_buff)\n+\t\treturn NULL;\n+\n+\tsize_gp_regset = sizeof (elf_gregset_t);\n+\trbytes = linux_reg_read (dbg, R_REG_TYPE_GPR, reg_buff, size_gp_regset);\n+\tif (rbytes != size_gp_regset) {                    /* something went wrong */\n+\t\tprintf (\"linux_get_prstatus: error in (rbytes != size_gp_regset)\\n\");","path":"libr/debug/p/native/linux/linux_debug.c","position":186,"original_position":186,"commit_id":"49c2f8979155c6ae6470756849af072eeb02c4c6","original_commit_id":"49c2f8979155c6ae6470756849af072eeb02c4c6","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"body":"Mist be eprintf","created_at":"2016-05-20T09:12:10Z","updated_at":"2016-05-20T09:12:10Z","html_url":"https://github.com/radare/radare2/pull/4956#discussion_r64011304","pull_request_url":"https://api.github.com/repos/radare/radare2/pulls/4956","_links":{"self":{"href":"https://api.github.com/repos/radare/radare2/pulls/comments/64011304"},"html":{"href":"https://github.com/radare/radare2/pull/4956#discussion_r64011304"},"pull_request":{"href":"https://api.github.com/repos/radare/radare2/pulls/4956"}}},"pull_request":{"url":"https://api.github.com/repos/radare/radare2/pulls/4956","id":70814258,"html_url":"https://github.com/radare/radare2/pull/4956","diff_url":"https://github.com/radare/radare2/pull/4956.diff","patch_url":"https://github.com/radare/radare2/pull/4956.patch","issue_url":"https://api.github.com/repos/radare/radare2/issues/4956","number":4956,"state":"open","locked":false,"title":"Add coredump on Linux x86_64. (Still missing thread support)","user":{"login":"leberus","id":8247317,"avatar_url":"https://avatars.githubusercontent.com/u/8247317?v=3","gravatar_id":"","url":"https://api.github.com/users/leberus","html_url":"https://github.com/leberus","followers_url":"https://api.github.com/users/leberus/followers","following_url":"https://api.github.com/users/leberus/following{/other_user}","gists_url":"https://api.github.com/users/leberus/gists{/gist_id}","starred_url":"https://api.github.com/users/leberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leberus/subscriptions","organizations_url":"https://api.github.com/users/leberus/orgs","repos_url":"https://api.github.com/users/leberus/repos","events_url":"https://api.github.com/users/leberus/events{/privacy}","received_events_url":"https://api.github.com/users/leberus/received_events","type":"User","site_admin":false},"body":"Add: Support for coredump under Linux x86_64. Is still lacking thread support but I plan to add it during the next week","created_at":"2016-05-20T08:00:15Z","updated_at":"2016-05-20T09:12:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"191989812db3aaeaad6b061de822294a74e386a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/radare/radare2/pulls/4956/commits","review_comments_url":"https://api.github.com/repos/radare/radare2/pulls/4956/comments","review_comment_url":"https://api.github.com/repos/radare/radare2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/radare/radare2/issues/4956/comments","statuses_url":"https://api.github.com/repos/radare/radare2/statuses/49c2f8979155c6ae6470756849af072eeb02c4c6","head":{"label":"leberus:coresupport","ref":"coresupport","sha":"49c2f8979155c6ae6470756849af072eeb02c4c6","user":{"login":"leberus","id":8247317,"avatar_url":"https://avatars.githubusercontent.com/u/8247317?v=3","gravatar_id":"","url":"https://api.github.com/users/leberus","html_url":"https://github.com/leberus","followers_url":"https://api.github.com/users/leberus/followers","following_url":"https://api.github.com/users/leberus/following{/other_user}","gists_url":"https://api.github.com/users/leberus/gists{/gist_id}","starred_url":"https://api.github.com/users/leberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leberus/subscriptions","organizations_url":"https://api.github.com/users/leberus/orgs","repos_url":"https://api.github.com/users/leberus/repos","events_url":"https://api.github.com/users/leberus/events{/privacy}","received_events_url":"https://api.github.com/users/leberus/received_events","type":"User","site_admin":false},"repo":{"id":56677398,"name":"radare2","full_name":"leberus/radare2","owner":{"login":"leberus","id":8247317,"avatar_url":"https://avatars.githubusercontent.com/u/8247317?v=3","gravatar_id":"","url":"https://api.github.com/users/leberus","html_url":"https://github.com/leberus","followers_url":"https://api.github.com/users/leberus/followers","following_url":"https://api.github.com/users/leberus/following{/other_user}","gists_url":"https://api.github.com/users/leberus/gists{/gist_id}","starred_url":"https://api.github.com/users/leberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leberus/subscriptions","organizations_url":"https://api.github.com/users/leberus/orgs","repos_url":"https://api.github.com/users/leberus/repos","events_url":"https://api.github.com/users/leberus/events{/privacy}","received_events_url":"https://api.github.com/users/leberus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leberus/radare2","description":"unix-like reverse engineering framework and commandline tools","fork":true,"url":"https://api.github.com/repos/leberus/radare2","forks_url":"https://api.github.com/repos/leberus/radare2/forks","keys_url":"https://api.github.com/repos/leberus/radare2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leberus/radare2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leberus/radare2/teams","hooks_url":"https://api.github.com/repos/leberus/radare2/hooks","issue_events_url":"https://api.github.com/repos/leberus/radare2/issues/events{/number}","events_url":"https://api.github.com/repos/leberus/radare2/events","assignees_url":"https://api.github.com/repos/leberus/radare2/assignees{/user}","branches_url":"https://api.github.com/repos/leberus/radare2/branches{/branch}","tags_url":"https://api.github.com/repos/leberus/radare2/tags","blobs_url":"https://api.github.com/repos/leberus/radare2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leberus/radare2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leberus/radare2/git/refs{/sha}","trees_url":"https://api.github.com/repos/leberus/radare2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leberus/radare2/statuses/{sha}","languages_url":"https://api.github.com/repos/leberus/radare2/languages","stargazers_url":"https://api.github.com/repos/leberus/radare2/stargazers","contributors_url":"https://api.github.com/repos/leberus/radare2/contributors","subscribers_url":"https://api.github.com/repos/leberus/radare2/subscribers","subscription_url":"https://api.github.com/repos/leberus/radare2/subscription","commits_url":"https://api.github.com/repos/leberus/radare2/commits{/sha}","git_commits_url":"https://api.github.com/repos/leberus/radare2/git/commits{/sha}","comments_url":"https://api.github.com/repos/leberus/radare2/comments{/number}","issue_comment_url":"https://api.github.com/repos/leberus/radare2/issues/comments{/number}","contents_url":"https://api.github.com/repos/leberus/radare2/contents/{+path}","compare_url":"https://api.github.com/repos/leberus/radare2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leberus/radare2/merges","archive_url":"https://api.github.com/repos/leberus/radare2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leberus/radare2/downloads","issues_url":"https://api.github.com/repos/leberus/radare2/issues{/number}","pulls_url":"https://api.github.com/repos/leberus/radare2/pulls{/number}","milestones_url":"https://api.github.com/repos/leberus/radare2/milestones{/number}","notifications_url":"https://api.github.com/repos/leberus/radare2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leberus/radare2/labels{/name}","releases_url":"https://api.github.com/repos/leberus/radare2/releases{/id}","deployments_url":"https://api.github.com/repos/leberus/radare2/deployments","created_at":"2016-04-20T10:20:27Z","updated_at":"2016-04-20T10:20:39Z","pushed_at":"2016-05-20T07:35:25Z","git_url":"git://github.com/leberus/radare2.git","ssh_url":"git@github.com:leberus/radare2.git","clone_url":"https://github.com/leberus/radare2.git","svn_url":"https://github.com/leberus/radare2","homepage":"http://www.radare.org/","size":58268,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"radare:master","ref":"master","sha":"5ae9f9b17f20d40cff2513a85c847916eac9828c","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"repo":{"id":4869294,"name":"radare2","full_name":"radare/radare2","owner":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/radare/radare2","description":"unix-like reverse engineering framework and commandline tools","fork":false,"url":"https://api.github.com/repos/radare/radare2","forks_url":"https://api.github.com/repos/radare/radare2/forks","keys_url":"https://api.github.com/repos/radare/radare2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/radare/radare2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/radare/radare2/teams","hooks_url":"https://api.github.com/repos/radare/radare2/hooks","issue_events_url":"https://api.github.com/repos/radare/radare2/issues/events{/number}","events_url":"https://api.github.com/repos/radare/radare2/events","assignees_url":"https://api.github.com/repos/radare/radare2/assignees{/user}","branches_url":"https://api.github.com/repos/radare/radare2/branches{/branch}","tags_url":"https://api.github.com/repos/radare/radare2/tags","blobs_url":"https://api.github.com/repos/radare/radare2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/radare/radare2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/radare/radare2/git/refs{/sha}","trees_url":"https://api.github.com/repos/radare/radare2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/radare/radare2/statuses/{sha}","languages_url":"https://api.github.com/repos/radare/radare2/languages","stargazers_url":"https://api.github.com/repos/radare/radare2/stargazers","contributors_url":"https://api.github.com/repos/radare/radare2/contributors","subscribers_url":"https://api.github.com/repos/radare/radare2/subscribers","subscription_url":"https://api.github.com/repos/radare/radare2/subscription","commits_url":"https://api.github.com/repos/radare/radare2/commits{/sha}","git_commits_url":"https://api.github.com/repos/radare/radare2/git/commits{/sha}","comments_url":"https://api.github.com/repos/radare/radare2/comments{/number}","issue_comment_url":"https://api.github.com/repos/radare/radare2/issues/comments{/number}","contents_url":"https://api.github.com/repos/radare/radare2/contents/{+path}","compare_url":"https://api.github.com/repos/radare/radare2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/radare/radare2/merges","archive_url":"https://api.github.com/repos/radare/radare2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/radare/radare2/downloads","issues_url":"https://api.github.com/repos/radare/radare2/issues{/number}","pulls_url":"https://api.github.com/repos/radare/radare2/pulls{/number}","milestones_url":"https://api.github.com/repos/radare/radare2/milestones{/number}","notifications_url":"https://api.github.com/repos/radare/radare2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/radare/radare2/labels{/name}","releases_url":"https://api.github.com/repos/radare/radare2/releases{/id}","deployments_url":"https://api.github.com/repos/radare/radare2/deployments","created_at":"2012-07-03T07:42:26Z","updated_at":"2016-05-20T02:00:10Z","pushed_at":"2016-05-20T08:00:15Z","git_url":"git://github.com/radare/radare2.git","ssh_url":"git@github.com:radare/radare2.git","clone_url":"https://github.com/radare/radare2.git","svn_url":"https://github.com/radare/radare2","homepage":"http://www.radare.org/","size":74954,"stargazers_count":2684,"watchers_count":2684,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":592,"mirror_url":null,"open_issues_count":746,"forks":592,"open_issues":746,"watchers":2684,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/radare/radare2/pulls/4956"},"html":{"href":"https://github.com/radare/radare2/pull/4956"},"issue":{"href":"https://api.github.com/repos/radare/radare2/issues/4956"},"comments":{"href":"https://api.github.com/repos/radare/radare2/issues/4956/comments"},"review_comments":{"href":"https://api.github.com/repos/radare/radare2/pulls/4956/comments"},"review_comment":{"href":"https://api.github.com/repos/radare/radare2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/radare/radare2/pulls/4956/commits"},"statuses":{"href":"https://api.github.com/repos/radare/radare2/statuses/49c2f8979155c6ae6470756849af072eeb02c4c6"}}}}
{"actor":{"display_login":"radare"}}