aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-08-10 05:03:13 +0000
committerMike Frysinger <vapier@gentoo.org>2012-08-10 05:03:13 +0000
commitde0bea007c446f40ecec90a2672e0a806d397e1a (patch)
tree239ac66f780b5afdb4cdc3e2115100a096c7e9b4 /gdb/common
parent44534af395e517016f70c2b0baee26f810391843 (diff)
downloadgdb-de0bea007c446f40ecec90a2672e0a806d397e1a.zip
gdb-de0bea007c446f40ecec90a2672e0a806d397e1a.tar.gz
gdb-de0bea007c446f40ecec90a2672e0a806d397e1a.tar.bz2
gdb: add completion handler for "handle" and "signal"
The command line completion has spoiled me. Thus the lack of completion with the "handle" command annoys me. Patch! This does a few things: - adds a VEC_merge helper - adds a generic signal completer - adds a completion handler for the "handle" command - sets the completion handler for the "signal" command URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10436 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/vec.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/gdb/common/vec.h b/gdb/common/vec.h
index 49116e1..a99bcd6 100644
--- a/gdb/common/vec.h
+++ b/gdb/common/vec.h
@@ -210,6 +210,13 @@
#define VEC_copy(T,V) (VEC_OP(T,copy)(V))
+/* Merge two vectors.
+ VEC(T,A) *VEC_T_merge(VEC(T) *, VEC(T) *);
+
+ Copy the live elements of both vectors into a new vector. The new
+ and old vectors need not be allocated by the same mechanism. */
+#define VEC_merge(T,V1,V2) (VEC_OP(T,merge)(V1, V2))
+
/* Determine if a vector has additional capacity.
int VEC_T_space (VEC(T) *v,int reserve)
@@ -461,6 +468,28 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
return new_vec_; \
} \
\
+static inline VEC(T) *VEC_OP (T,merge) (VEC(T) *vec1_, VEC(T) *vec2_) \
+{ \
+ if (vec1_ && vec2_) \
+ { \
+ size_t len_ = vec1_->num + vec2_->num; \
+ VEC (T) *new_vec_ = NULL; \
+ \
+ /* We must request exact size allocation, hence the negation. */ \
+ new_vec_ = (VEC (T) *) \
+ vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
+ \
+ new_vec_->num = len_; \
+ memcpy (new_vec_->vec, vec1_->vec, sizeof (T) * vec1_->num); \
+ memcpy (new_vec_->vec + vec1_->num, vec2_->vec, \
+ sizeof (T) * vec2_->num); \
+ \
+ return new_vec_; \
+ } \
+ else \
+ return VEC_copy (T, vec1_ ? vec1_ : vec2_); \
+} \
+ \
static inline void VEC_OP (T,free) \
(VEC(T) **vec_) \
{ \
@@ -741,6 +770,27 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
return new_vec_; \
} \
\
+static inline VEC(T) *VEC_OP (T,merge) (VEC(T) *vec1_, VEC(T) *vec2_) \
+{ \
+ if (vec1_ && vec2_) \
+ { \
+ size_t len_ = vec1_->num + vec2_->num; \
+ VEC (T) *new_vec_ = NULL; \
+ \
+ /* We must request exact size allocation, hence the negation. */ \
+ new_vec_ = (VEC (T) *)(vec_p_reserve (NULL, -len_)); \
+ \
+ new_vec_->num = len_; \
+ memcpy (new_vec_->vec, vec1_->vec, sizeof (T) * vec1_->num); \
+ memcpy (new_vec_->vec + vec1_->num, vec2_->vec, \
+ sizeof (T) * vec2_->num); \
+ \
+ return new_vec_; \
+ } \
+ else \
+ return VEC_copy (T, vec1_ ? vec1_ : vec2_); \
+} \
+ \
static inline int VEC_OP (T,reserve) \
(VEC(T) **vec_, int alloc_ VEC_ASSERT_DECL) \
{ \
@@ -975,6 +1025,28 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
return new_vec_; \
} \
\
+static inline VEC(T) *VEC_OP (T,merge) (VEC(T) *vec1_, VEC(T) *vec2_) \
+{ \
+ if (vec1_ && vec2_) \
+ { \
+ size_t len_ = vec1_->num + vec2_->num; \
+ VEC (T) *new_vec_ = NULL; \
+ \
+ /* We must request exact size allocation, hence the negation. */ \
+ new_vec_ = (VEC (T) *) \
+ vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
+ \
+ new_vec_->num = len_; \
+ memcpy (new_vec_->vec, vec1_->vec, sizeof (T) * vec1_->num); \
+ memcpy (new_vec_->vec + vec1_->num, vec2_->vec, \
+ sizeof (T) * vec2_->num); \
+ \
+ return new_vec_; \
+ } \
+ else \
+ return VEC_copy (T, vec1_ ? vec1_ : vec2_); \
+} \
+ \
static inline void VEC_OP (T,free) \
(VEC(T) **vec_) \
{ \