Patch to fix crashing experienced while using GDB



Hello,

Some time ago, I got the attached patch from jhb (IIRC). It has worked
for me and cured a problem that was making a bunch of my code
un-traceable using GDB on FreeBSD. Debugging would result in a crash of
GDB, preventing me from seeing what bug I had that crashed my program.

Anyhow, my question is: Is there any reason this shouldn't be pushed
into the tree? Who do I need to talk to (obrien? the compiler
maintainers?) about it?

--
Coleman Kane

diff --git a/contrib/gdb/gdb/target.c b/contrib/gdb/gdb/target.c
index ff47ac1..c241676 100644
--- a/contrib/gdb/gdb/target.c
+++ b/contrib/gdb/gdb/target.c
@@ -1425,6 +1425,13 @@ target_resize_to_sections (struct target_ops *target, int num_added)
(*t)->to_sections_end = target->to_sections_end;
}
}
+
+ /* JHB: Need to update current_target too. */
+ if (current_target.to_sections == old_value)
+ {
+ current_target.to_sections = target->to_sections;
+ current_target.to_sections_end = target->to_sections_end;
+ }
}

return old_count;

Attachment: signature.asc
Description: This is a digitally signed message part