aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-06-19 09:12:26 +0100
committerGary Benson <gbenson@redhat.com>2014-06-19 09:12:26 +0100
commiteae7090bea9d7f129be7dddf89f8e177cdb2003d (patch)
tree28804d4f3455eb633c4829f0c9c872314fdd8788 /gdb/utils.h
parent57fcfb1b202c09bf83e0e98dfb1d518e7be71d2c (diff)
Refactor and expose core-dumping functionality
This commit exposes the functions that dump core outside utils.c. can_dump_core gains a new parameter, "limit_kind", to allow either the soft or hard limit to be checked, and its printing has separated into the new function warn_cant_dump_core. The new function can_dump_core_warn does what can_dump_core previously did (print and warn). gdb/ 2014-06-19 Gary Benson <gbenson@redhat.com> * utils.h (resource_limit_kind): New enum. (can_dump_core): New declaration. (warn_cant_dump_core): Likewise. (dump_core): Likewise. * utils.c (dump_core): Made nonstatic. Added new parameter "limit_kind". (can_dump_core): Made nonstatic. Moved printing code to... (warn_cant_dump_core): New function. (can_dump_core_warn): Likewise. (internal_vproblem): Replace calls to can_dump_core with calls to can_dump_core_warn. Supply new argument to each.
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 9a10281e34..a91f5510f4 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -372,4 +372,28 @@ extern ULONGEST align_down (ULONGEST v, int n);
extern LONGEST gdb_sign_extend (LONGEST value, int bit);
+/* Resource limits used by getrlimit and setrlimit. */
+
+enum resource_limit_kind
+ {
+ LIMIT_CUR,
+ LIMIT_MAX
+ };
+
+/* Check whether GDB will be able to dump core using the dump_core
+ function. Returns zero if GDB cannot or should not dump core.
+ If LIMIT_KIND is LIMIT_CUR the user's soft limit will be respected.
+ If LIMIT_KIND is LIMIT_MAX only the hard limit will be respected. */
+
+extern int can_dump_core (enum resource_limit_kind limit_kind);
+
+/* Print a warning that we cannot dump core. */
+
+extern void warn_cant_dump_core (const char *reason);
+
+/* Dump core trying to increase the core soft limit to hard limit
+ first. */
+
+extern void dump_core (void);
+
#endif /* UTILS_H */