diff options
author | Ned Ludd <solar@gentoo.org> | 2006-01-16 15:19:32 +0000 |
---|---|---|
committer | Ned Ludd <solar@gentoo.org> | 2006-01-16 15:19:32 +0000 |
commit | 575ebda1aacbbd77aa0cf3d8896e182f762afd75 (patch) | |
tree | 56ac5560ece1297e9d3d8283b23da49da0ba71ae /sys-devel/gdb | |
parent | * bump (diff) | |
download | gentoo-2-575ebda1aacbbd77aa0cf3d8896e182f762afd75.tar.gz gentoo-2-575ebda1aacbbd77aa0cf3d8896e182f762afd75.tar.bz2 gentoo-2-575ebda1aacbbd77aa0cf3d8896e182f762afd75.zip |
- scanmem patch updates from the PaX Team. Fixed compilation warnings and clean up the control flow a bit (one less level of indentation) and I also added tab completion for 'scanmem'.
(Portage version: 2.1_pre1)
Diffstat (limited to 'sys-devel/gdb')
-rw-r--r-- | sys-devel/gdb/ChangeLog | 9 | ||||
-rw-r--r-- | sys-devel/gdb/Manifest | 14 | ||||
-rw-r--r-- | sys-devel/gdb/files/gdb-6.4-scanmem.patch | 365 |
3 files changed, 186 insertions, 202 deletions
diff --git a/sys-devel/gdb/ChangeLog b/sys-devel/gdb/ChangeLog index 9ab14c16efbe..f2fd34cc1638 100644 --- a/sys-devel/gdb/ChangeLog +++ b/sys-devel/gdb/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sys-devel/gdb -# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gdb/ChangeLog,v 1.82 2005/12/09 04:48:35 solar Exp $ +# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gdb/ChangeLog,v 1.83 2006/01/16 15:19:32 solar Exp $ + + 16 Jan 2006; <solar@gentoo.org> files/gdb-6.4-scanmem.patch: + - scanmem patch updates from the PaX Team. Fixed compilation warnings and + clean up the control flow a bit (one less level of indentation) and I also + added tab completion for 'scanmem'. *gdb-6.4-r1 (08 Dec 2005) diff --git a/sys-devel/gdb/Manifest b/sys-devel/gdb/Manifest index 34270e785316..87452fa39e5e 100644 --- a/sys-devel/gdb/Manifest +++ b/sys-devel/gdb/Manifest @@ -1,7 +1,4 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -MD5 818a63a042ed9604c80ce3331c44e668 ChangeLog 11985 +MD5 d3a0c5ca1085ae60aa1f4059ff9e9940 ChangeLog 12240 MD5 d3ab2683d88b3cbecb8a9faa439703a1 files/bfd-malloc-wrap.patch 782 MD5 460629563df21e6a68b8941c07d4f30b files/digest-gdb-6.1 131 MD5 b3790be989db97b22c599572afbce109 files/digest-gdb-6.2.1 133 @@ -25,7 +22,7 @@ MD5 2657b597618d0c35b48f47e3f808d171 files/gdb-6.3-relative-paths.patch 3286 MD5 a4610ec65e88f73e0b00b525467a5372 files/gdb-6.3-scanmem.patch 6652 MD5 8b7f5c46b8dabbc9239c37f52278b971 files/gdb-6.3-uclibc.patch 8221 MD5 8323dafe6749f0da44b8e11ebbbc96c4 files/gdb-6.4-relative-paths.patch 3147 -MD5 c8fced1c2241b098eae50b1f8c8ef463 files/gdb-6.4-scanmem.patch 6692 +MD5 2eb930fae4af7203dc929220ce68096c files/gdb-6.4-scanmem.patch 6176 MD5 ec7f411b90047b1ea848513ee5676072 files/gdb-6.4-sse2-register-display.patch 1533 MD5 78d8fa43c0e2e339346b3bc7aa10c2d9 files/gdb-6.4-uclibc.patch 2435 MD5 7ea8f83bb7b0d70e7e6d6c8cf42292d3 files/gdb-6.x-crash.patch 678 @@ -35,10 +32,3 @@ MD5 20334b11833489b3bcc13c0fea645a1d gdb-6.3-r4.ebuild 2983 MD5 abe5b46c3552ca8670ffb68c048d4ffd gdb-6.4-r1.ebuild 3009 MD5 f5428a658b66b60aeaa511d39cc450b3 gdb-6.4.ebuild 2996 MD5 567094e03359ffc1c95af7356395228d metadata.xml 162 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.2 (GNU/Linux) - -iD8DBQFDoi+12+ySkm8kpY0RAjxNAKCX5q+1FY9gNL5Pff3qLfSCWPm/JACeNeDA -DQD0r+lZ2ZhNUBGB40y5Tg4= -=ALbN ------END PGP SIGNATURE----- diff --git a/sys-devel/gdb/files/gdb-6.4-scanmem.patch b/sys-devel/gdb/files/gdb-6.4-scanmem.patch index 899977dda137..df3e06461486 100644 --- a/sys-devel/gdb/files/gdb-6.4-scanmem.patch +++ b/sys-devel/gdb/files/gdb-6.4-scanmem.patch @@ -1,223 +1,212 @@ -diff -Nrup gdb-6.4.orig/gdb/printcmd.c gdb-6.4/gdb/printcmd.c ---- gdb-6.4.orig/gdb/printcmd.c 2005-02-24 08:51:34.000000000 -0500 -+++ gdb-6.4/gdb/printcmd.c 2005-12-08 23:17:09.000000000 -0500 -@@ -942,6 +942,195 @@ print_command (char *exp, int from_tty) +--- gdb-6.4-old/gdb/printcmd.c 2005-02-24 14:51:34.000000000 +0100 ++++ gdb-6.4/gdb/printcmd.c 2005-12-11 01:38:27.000000000 +0100 +@@ -942,6 +942,187 @@ print_command (char *exp, int from_tty) print_command_1 (exp, 0, 1); } ++int partial_memory_read (CORE_ADDR memaddr, char *myaddr, int len, int *errnoptr); ++ +static void +scanmem_command(char *exp, int from_tty) +{ -+ struct expression *expr; -+ struct value *val; -+ struct format_data fmt; -+ CORE_ADDR addr; -+ unsigned char *data; -+ unsigned char *size; -+ unsigned char *pattern; -+ unsigned char typ; -+ unsigned char typc; -+ unsigned char my_buf[4]; -+ unsigned int nfetch; -+ unsigned int len = 10; -+ unsigned int memsize; -+ unsigned int i; -+ int typi; -+ int errcode; -+ -+ if (exp && *exp) { -+ struct type *type; -+ char *str_num = NULL; -+ char *string_to_seek = NULL; -+ char *tmp = strdup(exp); -+ char *c; -+ -+ c = tmp; -+ if (*c == ' ') -+ while (*c && *c == ' ') -+ c++; -+ -+ while (*c && *c != ' ') -+ c++; -+ -+ *c = '\0'; ++ struct expression *expr; ++ struct value *val; ++ struct format_data fmt; ++ CORE_ADDR addr; ++ unsigned char *data; ++ unsigned char *size; ++ unsigned char *pattern; ++ unsigned char typ; ++ unsigned int typc; ++ unsigned char my_buf[4]; ++ unsigned int nfetch; ++ unsigned int len = 10; ++ unsigned int memsize; ++ unsigned int i; ++ int typi; ++ int errcode; ++ struct type *type; ++ char *str_num = NULL; ++ char *string_to_seek = NULL; ++ char *tmp = strdup(exp); ++ char *c; ++ ++ if (!exp && !*exp) ++ return; ++ ++ c = tmp; ++ if (*c == ' ') ++ while (*c && *c == ' ') + c++; + -+ while (*c && *c == ' ') -+ c++; ++ while (*c && *c != ' ') ++ c++; + -+ size = c; ++ *c = '\0'; ++ c++; + -+ while (*c && *c != ' ') -+ c++; ++ while (*c && *c == ' ') ++ c++; + -+ *c = '\0'; -+ c++; ++ size = c; + -+ while (*c && *c == ' ') -+ c++; ++ while (*c && *c != ' ') ++ c++; + -+ typ = *c; -+ c++; ++ *c = '\0'; ++ c++; + -+ *c = '\0'; -+ c++; ++ while (*c && *c == ' ') ++ c++; ++ ++ typ = *c; ++ c++; ++ ++ *c = '\0'; ++ c++; + -+ while (*c && *c == ' ') -+ c++; -+ pattern = c; ++ while (*c && *c == ' ') ++ c++; ++ pattern = c; + -+ printf_filtered(">>addr %s: size %s: type:%c pattern:%s<< \n", -+ tmp, size, typ, pattern); ++ printf_filtered(">>addr %s: size %s: type:%c pattern:%s<< \n", tmp, size, typ, pattern); + -+ expr = parse_expression(tmp); -+ val = evaluate_expression(expr); ++ expr = parse_expression(tmp); ++ val = evaluate_expression(expr); + -+ if (TYPE_CODE(value_type(val)) == TYPE_CODE_REF) -+ val = value_ind(val); ++ if (TYPE_CODE(value_type(val)) == TYPE_CODE_REF) ++ val = value_ind(val); + -+ if (TYPE_CODE(value_type(val)) == TYPE_CODE_FUNC -+ && VALUE_LVAL(val) == lval_memory) -+ addr = VALUE_ADDRESS(val); ++ if (TYPE_CODE(value_type(val)) == TYPE_CODE_FUNC && VALUE_LVAL(val) == lval_memory) ++ addr = VALUE_ADDRESS(val); ++ else ++ addr = value_as_address(val); ++ ++ len = atoi(size); ++ data = xmalloc(len); ++ nfetch = partial_memory_read(addr, data, len, &errcode); ++ ++ if (nfetch != len) ++ printf_filtered("we can read only %i bytes\n", nfetch); ++ ++ switch (typ) { ++ case 's': ++ memsize = strlen(pattern); ++ if (nfetch < memsize) { ++ printf_filtered("we read only %i bytes and we seek for a pattern of %i bytes\n", ++ nfetch, memsize); ++ break; ++ } ++ for (i = 0; i <= (nfetch - memsize); i++, addr++) { ++ if (memcmp(data + i, pattern, memsize) == 0) { ++ printf_filtered("pattern match at "); ++ deprecated_print_address_numeric(addr, 1, gdb_stdout); ++ printf_filtered("\n"); ++ } ++ } ++ break; ++ ++ case 'i': ++ memsize = sizeof(int); ++ typi = atoi(pattern); ++ ++ if (nfetch < memsize) { ++ printf_filtered("we read only %i bytes and we seek for a pattern of %i bytes\n", ++ nfetch, memsize); ++ break; ++ } ++ for (i = 0; i <= (nfetch - memsize); i++, addr++) { ++ int *pint; ++ pint = (unsigned int *) (data + i); ++ if (*pint == typi) { ++ printf_filtered("pattern match at "); ++ deprecated_print_address_numeric(addr, 1, gdb_stdout); ++ printf_filtered("\n"); ++ } ++ } ++ break; ++ ++ case 'a': ++ memsize = sizeof(unsigned long); ++ if (sscanf(pattern, "0x%x", &i) == 0) { ++ printf_filtered("cant convert to hexa %s\n", pattern); ++ break; ++ } ++ my_buf[0] = (unsigned char) ((i & 0x000000FF)); ++ my_buf[1] = (unsigned char) ((i & 0x0000FF00) >> 8); ++ my_buf[2] = (unsigned char) ((i & 0x00FF0000) >> 16); ++ my_buf[3] = (unsigned char) ((i & 0xFF000000) >> 24); ++ if (nfetch < memsize) { ++ printf_filtered("we read only %i bytes and we seek for a pattern of %i bytes\n", ++ nfetch, memsize); ++ break; ++ } ++ for (i = 0; i <= (nfetch - memsize); i++, addr++) { ++ if (memcmp(data + i, my_buf, memsize) == 0) { ++ printf_filtered("pattern match at "); ++ deprecated_print_address_numeric(addr, 1, gdb_stdout); ++ printf_filtered("\n"); ++ } ++ } ++ break; ++ ++ case 'b': ++ case 'c': ++ memsize = sizeof(char); ++ if (typ == 'c') ++ typc = *pattern; ++ else { ++ if (strncmp("0x", pattern, 2) == 0) ++ sscanf(pattern, "0x%02x", &typc); + else -+ addr = value_as_address(val); -+ -+ len = atoi(size); -+ data = xmalloc(len); -+ nfetch = partial_memory_read(addr, data, len, &errcode); -+ -+ if (nfetch != len) -+ printf_filtered("we can read only %i bytes\n", nfetch); -+ -+ switch (typ) { -+ case 's': -+ memsize = strlen(pattern); -+ if (nfetch < memsize) { -+ printf_filtered -+ ("we read only %i bytes and we seek for a pattern of %i bytes\n", -+ nfetch, memsize); -+ free(data); -+ free(tmp); -+ return; -+ } -+ for (i = 0; i <= (nfetch - memsize); i++, addr++) { -+ if (memcmp(data + i, pattern, memsize) == 0) { -+ printf_filtered("pattern match at "); -+ deprecated_print_address_numeric((addr), 1, gdb_stdout); -+ printf_filtered("\n"); -+ } -+ } -+ break; -+ case 'i': -+ memsize = sizeof(int); -+ typi = atoi(pattern); -+ -+ if (nfetch < memsize) { -+ printf_filtered -+ ("we read only %i bytes and we seek for a pattern of %i bytes\n", -+ nfetch, memsize); -+ free(data); -+ free(tmp); -+ return; -+ } -+ for (i = 0; i <= (nfetch - memsize); i++, addr++) { -+ int *pint; -+ pint = (unsigned char *) (data + i); -+ if (*pint == typi) { -+ printf_filtered("pattern match at "); -+ deprecated_print_address_numeric((addr), 1, gdb_stdout); -+ printf_filtered("\n"); -+ } -+ } -+ break; -+ case 'a': -+ memsize = sizeof(unsigned long); -+ if (sscanf(pattern, "0x%x", &i) == 0) { -+ printf_filtered("cant convert to hexa %s\n", pattern); -+ break; -+ } -+ my_buf[0] = (unsigned char) ((i & 0x000000FF)); -+ my_buf[1] = (unsigned char) ((i & 0x0000FF00) >> 8); -+ my_buf[2] = (unsigned char) ((i & 0x00FF0000) >> 16); -+ my_buf[3] = (unsigned char) ((i & 0xFF000000) >> 24); -+ if (nfetch < memsize) { -+ printf_filtered -+ ("we read only %i bytes and we seek for a pattern of %i bytes\n", -+ nfetch, memsize); -+ free(data); -+ free(tmp); -+ return; -+ } -+ for (i = 0; i <= (nfetch - memsize); i++, addr++) { -+ if (memcmp((data + i), my_buf, memsize) == 0) { -+ printf_filtered("pattern match at "); -+ deprecated_print_address_numeric((addr), 1, gdb_stdout); -+ printf_filtered("\n"); -+ } -+ } -+ break; -+ case 'b': -+ case 'c': -+ memsize = sizeof(char); -+ if (typ == 'c') -+ typc = *pattern; -+ else { -+ if (strncmp("0x", pattern, 2) == 0) { -+ sscanf(pattern, "0x%02x", &typc); -+ } else -+ typc = (unsigned char)atoi(pattern); -+ } -+ printf_filtered(">>>%0x2\n", (int) typc); -+ if (nfetch < memsize) { -+ printf_filtered -+ ("we read only %i bytes and we seek for a pattern of %i bytes\n", -+ nfetch, memsize); -+ free(data); -+ free(tmp); -+ return; -+ } -+ for (i = 0; i <= (nfetch - memsize); i++, addr++) { -+ if (*(data + i) == typc) { -+ printf_filtered("pattern match at "); -+ deprecated_print_address_numeric((addr), 1, gdb_stdout); -+ printf_filtered("\n"); -+ } -+ } -+ break; -+ default: -+ printf_filtered("'%c' is not a valid type\n", typ); -+ break; ++ typc = (unsigned char)atoi(pattern); ++ } ++ printf_filtered(">>>%0x2\n", typc); ++ if (nfetch < memsize) { ++ printf_filtered("we read only %i bytes and we seek for a pattern of %i bytes\n", ++ nfetch, memsize); ++ break; ++ } ++ for (i = 0; i <= (nfetch - memsize); i++, addr++) { ++ if (data[i] == typc) { ++ printf_filtered("pattern match at "); ++ deprecated_print_address_numeric(addr, 1, gdb_stdout); ++ printf_filtered("\n"); + } -+ free(data); -+ free(tmp); -+ return; -+ } ++ } ++ break; ++ ++ default: ++ printf_filtered("'%c' is not a valid type\n", typ); ++ break; ++ } ++ free(data); ++ free(tmp); ++ return; +} + /* Same as print, except in epoch, it gets its own window */ static void inspect_command (char *exp, int from_tty) -@@ -2138,6 +2327,17 @@ EXP may be preceded with /FMT, where FMT +@@ -2138,6 +2319,16 @@ EXP may be preceded with /FMT, where FMT but no count or size letter (see \"x\" command).")); set_cmd_completer (c, location_completer); add_com_alias ("p", "print", class_vars, 1); -+ c = -+ add_com ("scanmem", class_vars, scanmem_command, -+ "scanmem <addr> <num> <type> <string>\n" -+ "example: scanmem $esp 100 a 0x8048434\n" -+ " scan for this addr into the stack\n\n" -+ " scanmem 0x08048434 100 s fsck\n" -+ " seek for a string\n" -+ " scanmem 0x8048434 100 b 0x75\n" -+ " scan for the char 0x75\n" -+ " a = address c = char b = byte i = int s = string\n" -+ "\n"); /* antilove@zolo.freelsd.net */ ++ c = add_com ("scanmem", class_vars, scanmem_command, _("\ ++scanmem <addr> <num> <type> <string>\n\ ++example: scanmem $esp 100 a 0x8048434\n\ ++ scan for this addr on the stack\n\n\ ++ scanmem 0x08048434 100 s fsck\n\ ++ seek for a string\n\ ++ scanmem 0x8048434 100 b 0x75\n\ ++ scan for the char 0x75\n\ ++ a = address c = char b = byte i = int s = string")); /* antilove@zolo.freelsd.net */ ++ set_cmd_completer (c, location_completer); c = add_com ("inspect", class_vars, inspect_command, _("\ Same as \"print\" command, except that if you are running in the epoch\n\ -diff -Nrup gdb-6.4.orig/gdb/valprint.c gdb-6.4/gdb/valprint.c ---- gdb-6.4.orig/gdb/valprint.c 2005-10-09 21:03:59.000000000 -0400 -+++ gdb-6.4/gdb/valprint.c 2005-12-08 23:17:09.000000000 -0500 +--- gdb-6.4-old/gdb/valprint.c 2005-10-10 03:03:59.000000000 +0200 ++++ gdb-6.4/gdb/valprint.c 2005-12-10 13:22:40.000000000 +0100 @@ -39,7 +39,7 @@ /* Prototypes for local functions */ |