* [patch] memleak in catch catch
@ 2008-04-29 20:37 Aleksandar Ristovski
2008-04-30 3:12 ` Aleksandar Ristovski
0 siblings, 1 reply; 3+ messages in thread
From: Aleksandar Ristovski @ 2008-04-29 20:37 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 519 bytes --]
Hello,
A trivial patch to fix memory leak in handle_gnu_v3_exceptions... this is probably going to change soon to allow setting catchpoints before program starts, but still.
Thanks,
Aleksandar Ristovski
QNX Software Systems
ChangeLog:
* breakpoint.c (struct decode_line_args): New structure for passing
arguments to decode_line_1.
(call_decode_line_1): New function.
(handle_gnu_v3_exceptions): Call decode_line_1 via catch_exception and
the new call_decode_line_1 function. Free allocated string on failure.
[-- Attachment #2: breakpoint.c.memleak.diff --]
[-- Type: text/plain, Size: 1590 bytes --]
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.316
diff -u -p -r1.316 breakpoint.c
--- gdb/breakpoint.c 26 Apr 2008 05:43:45 -0000 1.316
+++ gdb/breakpoint.c 29 Apr 2008 18:20:24 -0000
@@ -6561,6 +6561,19 @@ static struct breakpoint_ops gnu_v3_exce
print_mention_exception_catchpoint
};
+struct decode_line_args
+{
+ char **argptr;
+ struct symtabs_and_lines *sals;
+};
+
+static void
+call_decode_line_1 (struct ui_out *ui_out, void *arg)
+{
+ struct decode_line_args *dlargs = arg;
+ *dlargs->sals = decode_line_1 (dlargs->argptr, 1, NULL, 0, NULL, NULL);
+}
+
static int
handle_gnu_v3_exceptions (int tempflag, char *cond_string,
enum exception_event_kind ex_event, int from_tty)
@@ -6568,18 +6581,23 @@ handle_gnu_v3_exceptions (int tempflag,
char *trigger_func_name, *nameptr;
struct symtabs_and_lines sals;
struct breakpoint *b;
+ struct decode_line_args dlargs = { &nameptr, &sals };
+ struct gdb_exception e;
+ sals.nelts = 0;
+
if (ex_event == EX_EVENT_CATCH)
trigger_func_name = xstrdup ("__cxa_begin_catch");
else
trigger_func_name = xstrdup ("__cxa_throw");
nameptr = trigger_func_name;
- sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL, NULL);
+ e = catch_exception (uiout, call_decode_line_1,
+ &dlargs, RETURN_MASK_ERROR);
if (sals.nelts == 0)
{
xfree (trigger_func_name);
- return 0;
+ throw_exception (e);
}
b = set_raw_breakpoint (sals.sals[0], bp_breakpoint);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] memleak in catch catch
2008-04-29 20:37 [patch] memleak in catch catch Aleksandar Ristovski
@ 2008-04-30 3:12 ` Aleksandar Ristovski
2008-04-30 3:22 ` Aleksandar Ristovski
0 siblings, 1 reply; 3+ messages in thread
From: Aleksandar Ristovski @ 2008-04-30 3:12 UTC (permalink / raw)
Cc: gdb-patches
Aleksandar Ristovski wrote:
> Hello,
>
> A trivial patch to fix memory leak in handle_gnu_v3_exceptions... this
> is probably going to change soon to allow setting catchpoints before
> program starts, but still.
>
Disregard, please. A new patch is submitted that removes this issue altogether.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] memleak in catch catch
2008-04-30 3:12 ` Aleksandar Ristovski
@ 2008-04-30 3:22 ` Aleksandar Ristovski
0 siblings, 0 replies; 3+ messages in thread
From: Aleksandar Ristovski @ 2008-04-30 3:22 UTC (permalink / raw)
To: gdb-patches; +Cc: gdb-patches
Aleksandar Ristovski wrote:
> Hello,
>
> A trivial patch to fix memory leak in handle_gnu_v3_exceptions... this
> is probably going to change soon to allow setting catchpoints before
> program starts, but still.
>
Disregard, please. A new patch is submitted that removes this issue altogether.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-29 20:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-29 20:37 [patch] memleak in catch catch Aleksandar Ristovski
2008-04-30 3:12 ` Aleksandar Ristovski
2008-04-30 3:22 ` Aleksandar Ristovski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox