Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
20ff379e
Commit
20ff379e
authored
Oct 24, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump: Append threads to the core file
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@gmail.com
>
parent
63e08215
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
9 deletions
+44
-9
cr-dump.c
cr-dump.c
+44
-9
No files found.
cr-dump.c
View file @
20ff379e
...
@@ -930,6 +930,26 @@ static struct vma_area *find_vma_by_addr(struct list_head *vma_area_list, unsign
...
@@ -930,6 +930,26 @@ static struct vma_area *find_vma_by_addr(struct list_head *vma_area_list, unsign
return
NULL
;
return
NULL
;
}
}
static
int
append_thread_core
(
struct
cr_fdset
*
dst
,
struct
cr_fdset
*
src
)
{
const
int
size
=
sizeof
(
struct
core_entry
);
int
fd_core_dst
=
dst
->
desc
[
CR_FD_CORE
].
fd
;
int
fd_code_src
=
src
->
desc
[
CR_FD_CORE
].
fd
;
int
ret
=
-
1
;
lseek
(
fd_core_dst
,
0
,
SEEK_END
);
lseek
(
fd_code_src
,
MAGIC_OFFSET
,
SEEK_SET
);
if
(
sendfile
(
fd_core_dst
,
fd_code_src
,
NULL
,
size
)
!=
size
)
{
pr_perror
(
"Appending thread code failed
\n
"
);
goto
err
;
}
ret
=
0
;
err:
return
ret
;
}
/* kernel expects a special format in core file */
/* kernel expects a special format in core file */
static
int
finalize_core
(
pid_t
pid
,
struct
list_head
*
vma_area_list
,
struct
cr_fdset
*
cr_fdset
)
static
int
finalize_core
(
pid_t
pid
,
struct
list_head
*
vma_area_list
,
struct
cr_fdset
*
cr_fdset
)
{
{
...
@@ -1182,6 +1202,7 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
...
@@ -1182,6 +1202,7 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
{
{
LIST_HEAD
(
pstree_list
);
LIST_HEAD
(
pstree_list
);
struct
cr_fdset
*
cr_fdset
=
NULL
;
struct
cr_fdset
*
cr_fdset
=
NULL
;
struct
cr_fdset
*
cr_fdset_thread
=
NULL
;
struct
pstree_item
*
item
;
struct
pstree_item
*
item
;
int
i
,
ret
=
-
1
;
int
i
,
ret
=
-
1
;
...
@@ -1226,26 +1247,35 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
...
@@ -1226,26 +1247,35 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
if
(
dump_one_task
(
item
->
pid
,
cr_fdset
))
if
(
dump_one_task
(
item
->
pid
,
cr_fdset
))
goto
err
;
goto
err
;
close_cr_fdset
(
cr_fdset
);
free_cr_fdset
(
&
cr_fdset
);
if
(
item
->
nr_threads
>
1
)
{
if
(
item
->
nr_threads
>
1
)
{
for
(
i
=
0
;
i
<
item
->
nr_threads
;
i
++
)
{
for
(
i
=
0
;
i
<
item
->
nr_threads
;
i
++
)
{
/* Leader is already dumped */
/* Leader is already dumped */
if
(
item
->
pid
==
item
->
threads
[
i
])
if
(
item
->
pid
==
item
->
threads
[
i
])
continue
;
continue
;
cr_fdset
=
alloc_cr_fdset
(
item
->
threads
[
i
]);
if
(
!
cr_fdset
)
cr_fdset_thread
=
alloc_cr_fdset
(
item
->
threads
[
i
]);
if
(
!
cr_fdset_thread
)
goto
err
;
goto
err
;
if
(
prep_cr_fdset_for_dump
(
cr_fdset
,
CR_FD_DESC_CORE
))
if
(
prep_cr_fdset_for_dump
(
cr_fdset_thread
,
CR_FD_DESC_CORE
))
goto
err
;
goto
err
;
if
(
dump_task_thread
(
item
->
threads
[
i
],
cr_fdset
))
if
(
dump_task_thread
(
item
->
threads
[
i
],
cr_fdset_thread
))
goto
err
;
if
(
append_thread_core
(
cr_fdset
,
cr_fdset_thread
))
goto
err
;
goto
err
;
close_cr_fdset
(
cr_fdset
);
free_cr_fdset
(
&
cr_fdset
);
close_cr_fdset
(
cr_fdset_thread
);
free_cr_fdset
(
&
cr_fdset_thread
);
}
}
}
}
close_cr_fdset
(
cr_fdset
);
free_cr_fdset
(
&
cr_fdset
);
if
(
opts
->
leader_only
)
if
(
opts
->
leader_only
)
break
;
break
;
}
}
...
@@ -1261,7 +1291,12 @@ err:
...
@@ -1261,7 +1291,12 @@ err:
}
}
free_pstree
(
&
pstree_list
);
free_pstree
(
&
pstree_list
);
close_cr_fdset
(
cr_fdset
);
close_cr_fdset
(
cr_fdset
);
free_cr_fdset
(
&
cr_fdset
);
free_cr_fdset
(
&
cr_fdset
);
close_cr_fdset
(
cr_fdset_thread
);
free_cr_fdset
(
&
cr_fdset_thread
);
return
ret
;
return
ret
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment