From: Antonio B. <bor...@gm...> - 2021-02-25 22:35:23
|
On Thu, Feb 25, 2021 at 12:12 PM Alexander Gabitov <ga...@pl...> wrote: > > Hi, Antonio, > > you are right, I looked at line > src/server/gdb_server.c:2753 if (retval != ERROR_OK) > and saw it like: if (retval == ERROR_OK) > > I was wrong about the place where it happened but still the bug have a > place. > Hi Alexander, please keep the mailing list in copy so everyone can benefit by this conversation. Could you please try again after removing this event handler mb86h61.cpu configure -event resumed { ... } from your config file? I replicated the issue on a cortex_m target by simply adding a dummy <target_name> configure -event resumed {echo "in event resumed"} I want to understand if there is some other condition in your script that causes the issue or removing the event "resumed" is enough. Regards, Antonio > In attachment you can see the place in the log where bug happens and my > comments. I guess arm11_poll() is called in callback: > target_resume() -> arm11_resume() -> > target_call_event_callbacks(target, TARGET_EVENT_RESUMED): > > Listing of "target.c": > ...... > target_handle_event(target, event); /* Gabitov: May be arm11_poll() > was called here */ > > while (callback) { > next_callback = callback->next; > callback->callback(target, event, callback->priv); /* Gabitov: > or which is more probably arm11_poll() was called here */ > callback = next_callback; > } > ...... > > 24.02.2021 21:47, Antonio Borneo пишет: > > Hi Alexander, > > > > you point to the line > > src/server/gdb_server.c:2753 retval = target_poll(target); > > but that line is executed only when > > src/server/gdb_server.c:2746 retval = target_resume(target, 1, 0, 0, 0); > > returns error. > > > > In the logs you have provided I do not see such error returned by > > target_resume(). > > Look like your code calls target_poll() even when target_resume() > > returns ERROR_OK! > > Can you please clarify this? > > > > So far I cannot replicate this issue, but I do not have an ARM11. > > Maybe the problem is in arm11_resume() > > > > Regards > > Antonio > > > > > > On Wed, Feb 24, 2021 at 5:28 PM Paul Fertser <fer...@gm...> wrote: > >> > >> -- > >> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! > >> mailto:fer...@gm... > >> > >> > >> > >> ---------- Forwarded message ---------- > >> From: "Габитов Александр Фаритович via OpenOCD-user" <ope...@li...> > >> To: ope...@li... > >> Cc: > >> Bcc: > >> Date: Wed, 24 Feb 2021 16:24:20 +0500 > >> Subject: [OpenOCD-user] v0.11.0-rc2. Found bug when stepping or continue with debugger. > >> Hello! > >> > >> Recently I had to update the program from version 8-rc1 to version 11-rc2(from archive) to support the J-link v9 debugger. While debugging with a new version of the program when stepping, or when starting the program after a breakpoint - the control did not return to the console, while in the console I saw the following lines: > >> > >> target halted in ARM state due to breakpoint, current mode: System > >> cpsr: 0x6000011f pc: 0x41703480 > >> > >> I found that the problem is in the function 'gdb_handle_vcont_packet' (gdb_server.c): > >> > >> /* simple case, a continue packet */ > >> if (parse[0] == 'c') { > >> gdb_running_type = 'c'; > >> LOG_DEBUG("target %s continue", target_name(target)); > >> log_add_callback(gdb_log_callback, connection); > >> retval = target_resume(target, 1, 0, 0, 0); > >> if (retval == ERROR_TARGET_NOT_HALTED) > >> LOG_INFO("target %s was not halted when resume was requested", target_name(target)); > >> > >> /* poll target in an attempt to make its internal state consistent */ > >> if (retval != ERROR_OK) { > >> retval = target_poll(target); > >> if (retval != ERROR_OK) > >> LOG_DEBUG("error polling target %s after failed resume", target_name(target)); > >> } > >> > >> /* > >> * We don't report errors to gdb here, move frontend_state to > >> * TARGET_RUNNING to stay in sync with gdb's expectation of the > >> * target state > >> */ > >> gdb_connection->frontend_state = TARGET_RUNNING; > >> target_call_event_callbacks(target, TARGET_EVENT_GDB_START); > >> > >> return true; > >> } > >> > >> I will explain how I did it. I added 3 breakpoints and tried to navigate between them using the continue command. The problem is in string [ retval = target_poll(target); ]. Polling the target here leads to updating it state (if target hits breakpoint before polling), and than when we running frontend it never sees changing of target state. As a result we got target halted but running frontend. The previous version (v0.10.0) works fine, cause it doesnot poll target during process of continue command. > >> > >> The same problem when i do stepping (over or into). > >> > >> I should mention that sometimes everything works fine because target hits breakpoint after polling in continue command. > >> > >> I'll attach console log, debug log and CFG file. > >> > >> Note: I added some more debug meassages to source codes and most of them i have marked with label - Gabitov: or gabitov:, but some are unmarked (for example - 'enter DSCR_CORE_HALTED'). So if you find unrecognized message in debug log probably it's mine. The source codes version is 0.11.0-rc2 (from archive - https://sourceforge.net/projects/openocd/files/openocd/0.11.0-rc2/openocd-0.11.0-rc2.zip). > >> > >> I will provide more detailed information if needed. > >> > >> ------------------ > >> > >> Alexander Gabitov, Engineer, LLC PLANAR > >> > >> > >> _______________________________________________ > >> OpenOCD-user mailing list > >> Ope...@li... > >> https://lists.sourceforge.net/lists/listinfo/openocd-user > > -- > Best regards, > Alexander Gabitov, engineer, "PLANAR" LLC > |