|
From: Magnus L. <lu...@ml...> - 2008-04-17 22:55:24
|
Edwin Olson wrote: > I'm attaching a patch that improves breakpoint handling on cortex-m3 > parts. Specifically, this patch allows expressions to be evaluated in > GDB that contain function calls. > > It does two things in order to make this work: > > 1) Forces all breakpoints to be of length 2. GDB creates breakpoints > with length=4, and I don't know why. My solution may not be correct > here, and should be checked by someone who understands this better. > (The patch does seem to work, however!) > > 2) It forces all writes to the link register (R14 aka LR) to have the > LSB set, thus marking the return address as containing thumb code. > This is necessary because GDB tries to set a return address LR=0, > which causes an INVSTATE exception. > > Perhaps some of these would be better fixed in GDB, but that code is > scary! > > -Ed > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Openocd-development mailing list > Ope...@li... > https://lists.berlios.de/mailman/listinfo/openocd-development Hi, This should work, or at lest not break anything, but if GDB does not understand that Thumb-2 instructions are aligned on 2byte boundaries then debugging will probably fail in weird ways anyway. What happens when we try to single step machine code or breakpoints on branch instructions that are not 4 byte aligned ? This really should be in GDB. I am not opposed to the patch as I dont think it will break any correct normal usage, but it is a cure for symptoms and not for the cause, and I am afraid that that it will not cure the actual problem. Perhaps we need to check carefully how different Thumb-2 patches for GDB ( codesourcery vs main trunk ) handles Thumb-2 and if there are any flags to tell GDB to do things the right way. Regards, Magnus |