This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/21873] GDB Crashes when ^C pressed while debugging ARM-Cortex M4F
- From: "ihkose at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 02 Aug 2017 22:40:17 +0000
- Subject: [Bug c++/21873] GDB Crashes when ^C pressed while debugging ARM-Cortex M4F
- Auto-submitted: auto-generated
- References: <bug-21873-4717@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21873
--- Comment #10 from Ismail <ihkose at gmail dot com> ---
│1030
│
│1031 int
│
│1032 find_and_open_source (const char *filename,
│
│1033 const char *dirname,
│
│1034 char **fullname)
│
│1035 {
│
.............
┌──../../binutils-gdb/gdb/source.c──────────────────────────────────────────────────────
│1052 xfree (*fullname);
│1053 *fullname = rewritten_fullname;
│1054 }
│1055
│1056 result = gdb_open_cloexec (*fullname, OPEN_MODE, 0);
│1057 if (result >= 0)
│1058 {
│1059 char *lpath = gdb_realpath (*fullname);
│1060
│1061 xfree (*fullname);
│1062 *fullname = lpath;
│1063 return result;
│1064 }
│1065
│1066 /* Didn't work -- free old one, try again. */
│1067 xfree (*fullname);
│1068 *fullname = NULL;
│1069 }
│1070
│1071 cleanup = make_cleanup (null_cleanup, NULL);
│1072
│1073 if (dirname != NULL)
│1074 {
│1075 /* If necessary, rewrite the compilation directory name
according
│1076 to the source path substitution rules specified by the
user. */
│1077
│1078 char *rewritten_dirname = rewrite_source_path (dirname);
│1079
│1080 if (rewritten_dirname != NULL)
│1081 {
│1082 make_cleanup (xfree, rewritten_dirname);
│1083 dirname = rewritten_dirname;
│1084 }
│1085
│1086 /* Replace a path entry of $cdir with the compilation
directory
│1087 name. */
│1088 #define cdir_len 5
│1089 /* We cast strstr's result in case an ANSIhole has made it
const,
│1090 which produces a "required warning" when assigned to a
nonconst. */
│1091 p = (char *) strstr (source_path, "$cdir");
│1092 if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
│1093 && (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] ==
'\0'))
│1094 {
│1095 int len;
│1096
│1097 path = (char *)
>│1098 alloca (strlen (source_path) + 1 + strlen (dirname) +
1); /*CRASHES HERE */
│1099 len = p - source_path;
│1100 strncpy (path, source_path, len); /* Before $cdir */
│1101 strcpy (path + len, dirname); /* new stuff */
│1102 strcat (path + len, source_path + len + cdir_len); /*
After
│1103
$cdir */
│1104 }
│1105 }
└───────────────────────────────────────────────────────────────────────────────────────
multi-thre Thread 0x7f03cf6957 In: find_and_open_source
#20 0x00000000005719d9 in gdb_rl_callback_read_char_wrapper (client_
#21 0x0000000000571f60 in stdin_event_handler (error=<optimized out>
#22 0x0000000000570d5d in gdb_wait_for_event (block=block@entry=1) a
#23 0x0000000000570eb2 in gdb_do_one_event () at ../../binutils-gdb/
#24 0x000000000057100e in gdb_do_one_event () at ../../binutils-gdb/
#25 start_event_loop () at ../../binutils-gdb/gdb/event-loop.c:371
#26 0x00000000005c8038 in captured_command_loop (data=data@entry=0x0
#27 0x00000000005730e3 in catch_errors (func=func@entry=0x5c8010 <ca
at ../../binutils-gdb/gdb/exceptions.c:236
#28 0x00000000005c8ef6 in captured_main (data=0x7ffd6a7b47b0) at ../
---Type <return> to continue, or q <return> to quit---
#29 gdb_main (args=args@entry=0x7ffd6a7b48f0) at ../../binutils-gdb/
#30 0x000000000040e015 in main (argc=<optimized out>, argv=<optimize
(gdb) up
#1 0x000000000061222b in find_and_open_source (filename=0x20c <erro
fullname=fullname@entry=0x2912d28) at ../../binutils-gdb/gdb/sou
(gdb) p source_path
$1 = 0x23c36e0 "$cdir:$cwd"
(gdb) p dirname
$2 = 0x303078302829745f <error: Cannot access memory at address 0x30
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.