Skip to content

Commit 73af1d2

Browse files
committed
no set gdb context and fix read userspace vma
Signed-off-by: Penguin. <chenguanyou9338@gmail.com>
1 parent 27f0312 commit 73af1d2

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

cmdline/cmd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void parser_cmdline_main(void) {
4646
}
4747
}
4848

49-
set_context(tc->task, NO_PID, TRUE);
49+
set_context(tc->task, NO_PID, FALSE);
5050

5151
tm = &task_mem_usage;
5252
get_task_mem_usage(tc->task, tm);
@@ -75,6 +75,8 @@ void parser_cmdline_main(void) {
7575
int page_exist = uvtop(tc, arg_start_addr + anon_buf_off, &paddr, 0);
7676
ulong off = PAGEOFFSET(arg_start_addr + anon_buf_off);
7777
uint64_t read_size = (PAGESIZE() - off > anon_buf_use) ? anon_buf_use : (PAGESIZE() - off);
78+
if (!read_size)
79+
break;
7880

7981
if (paddr) {
8082
if (page_exist) {

core/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void parser_core_main(void) {
5858
fprintf(fp, "No such pid: %d\n", core_data.pid);
5959
return;
6060
}
61-
set_context(core_data.tc->task, NO_PID, TRUE);
61+
set_context(core_data.tc->task, NO_PID, FALSE);
6262

6363
readmem(core_data.tc->task + PARSER_OFFSET(task_struct_flags), KVADDR,
6464
&flags, sizeof(flags), "task_struct flags", FAULT_ON_ERROR);
@@ -208,6 +208,8 @@ void parser_core_fill_vma_name(struct core_data_t* core_data) {
208208
int page_exist = uvtop(core_data->tc, core_data->vma_cache[index].anon_name + anon_buf_off, &paddr, 0);
209209
ulong off = PAGEOFFSET(core_data->vma_cache[index].anon_name + anon_buf_off);
210210
uint64_t read_size = (core_data->page_size - off > anon_buf_use) ? anon_buf_use : (core_data->page_size - off);
211+
if (!read_size)
212+
break;
211213

212214
if (paddr) {
213215
if (page_exist) {

parser.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ int parser_vma_caches(struct task_context *tc, struct vma_cache_data **vma_cache
336336

337337
tm = &task_mem_usage;
338338
get_task_mem_usage(tc->task, tm);
339+
if (!tm->mm_struct_addr)
340+
return vma_count;
339341

340342
if (!PARSER_VALID_MEMBER(mm_struct_mmap)
341343
&& PARSER_VALID_MEMBER(mm_struct_mm_mt)) {

0 commit comments

Comments
 (0)