-
Notifications
You must be signed in to change notification settings - Fork 399
Add Process.ExtractAsFile interface #427
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -312,6 +312,12 @@ func (cd *CoredumpProcess) OpenELF(path string) (*pfelf.File, error) { | |||||
| return nil, fmt.Errorf("ELF file `%s` not found", path) | ||||||
| } | ||||||
|
|
||||||
| // ExtractAsFile implements the Process interface | ||||||
| func (cd *CoredumpProcess) ExtractAsFile(_ string) (string, error) { | ||||||
| // No filesystem level backing file in coredumps | ||||||
|
Contributor
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.
Suggested change
|
||||||
| return "", errors.New("coredump does not support opening backing file") | ||||||
| } | ||||||
|
|
||||||
| // getFile returns (creating if needed) a matching CoredumpFile for given file name | ||||||
| func (cd *CoredumpProcess) getFile(name string) *CoredumpFile { | ||||||
| if cf, ok := cd.files[name]; ok { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,16 @@ func (tc *trackedCoredump) OpenELF(fileName string) (*pfelf.File, error) { | |
| return tc.CoredumpProcess.OpenELF(fileName) | ||
| } | ||
|
|
||
| func (tc *trackedCoredump) ExtractAsFile(fileName string) (string, error) { | ||
| prefixedFileName := tc.prefix + fileName | ||
|
Contributor
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. Ideally, we should use
Contributor
Author
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'd also then fix the whole in follow up PR if ok? |
||
| if _, err := os.Stat(prefixedFileName); err != nil { | ||
| tc.warnMissing(fileName) | ||
| return "", err | ||
| } | ||
| tc.seen[fileName] = libpf.Void{} | ||
| return prefixedFileName, nil | ||
| } | ||
|
|
||
| func newNewCmd(store *modulestore.Store) *ffcli.Command { | ||
| args := &newCmd{store: store} | ||
|
|
||
|
|
||
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.
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.
This follows style of the file. Would it make sense to fixup the whole file in a follow up PR?