Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'toLowerCase' of undefined #650

Closed
weinand opened this issue Apr 19, 2017 · 6 comments
Closed

Cannot read property 'toLowerCase' of undefined #650

weinand opened this issue Apr 19, 2017 · 6 comments

Comments

@weinand
Copy link

weinand commented Apr 19, 2017

From @tiamattia on April 19, 2017 21:24

  • VSCode Version: Code 1.11.2 (6eaebe3b9c70406d67c97779468c324a7a95db0e, 2017-04-13T08:01:14.464Z)
  • OS Version: Linux x64 4.8.0-46-generic
  • Extensions:
Extension Author Version
vscode-solarized Braver 0.0.3
uncrustify LaurentTreguier 1.5.1
cpptools ms-vscode 0.10.5
sublime-keybindings ms-vscode 2.0.1

I'm trying to configure a remote target debugging session. The target is an STM32 microcontroller and the debugging server is OpenOCD.
When launching the debug I get this error: "Cannot read property 'toLowerCase' of undefined"


Steps to Reproduce:

  1. { "version": "0.2.0", "configurations": [ { "name": "STM32 Attach", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/bin/discovery-radio.elf", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": false, "setupCommands": [ { "text": "target remote localhost:3333" }, { "text": "file ${workspaceRoot}/bin/discovery-radio.elf" }, { "text": "monitor reset halt" } ], "customLaunchSetupCommands": [ { "text": "monitor reset halt" } ], "MIMode": "gdb", "launchCompleteCommand": "exec-continue", "miDebuggerPath": "/usr/bin/arm-miosix-eabi-gdb", "miDebuggerServerAddress": "localhost:3333", "debugServerPath": "/usr/bin/openocd", "debugServerArgs": "-f ${workspaceRoot}/somepath/stm32f4discovery.cfg", "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware", "filterStderr": true } ] }

  2. Launch debug

Copied from original issue: microsoft/vscode#25042

@weinand
Copy link
Author

weinand commented Apr 19, 2017

From @mjbvz on April 19, 2017 21:42

I've also seen this error. Here's the only trace I see:

Cannot read property 'toLowerCase' of undefined
e.doShow @ //Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:28

@sean-mcmanus
Copy link
Contributor

@tiamattia @mjbvz We should have a fix in our next update. In the mean time you can try working around this by changing the code that calls the toLower at .vscode/extensions/ms-vscode.cpptools-0.10.5/out/src/Debugger/nativeAttach.js
to
processEntries.sort((a, b) => { if (a.name == undefined) return 1; if (b.name == undefined) return -1; return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; });
and in attachToProcess.js:
.sort((a, b) => { if (a.name == undefined) return 1; if (b.name == undefined) return -1; return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; })

@marcoconti83
Copy link

Hi @sean-mcmanus , thanks for the tip, however just changing those files for me does not fix the issue. Is there anything I need to do after changing those files?

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Apr 20, 2017

@marcoconti83 Hmm...that should be it. You have to restart your VS Code instance (and make sure you're changing the correct file, i.e. if you're on Insiders or not). What error are you getting now? When I change the < to > in the javascript, and then start an Attach, I see the list in reverse order. Do you see that? From your bug description, it's not clear that we are the cause of the toLowerCase error message, but it sounded like weinand debugged it and thought we were the cause.

@marcoconti83
Copy link

@sean-mcmanus thanks for your reply. After further investigation I believe my issue to be unrelated to this. I ended up on the linked original issue (on the vscode repo) by searching for the exact error on a search engine, but I now believe this is caused for me by another, unrelated plugin and not cpptools. Sorry for the mix-up!

@pieandcakes
Copy link
Contributor

@marcoconti83 Closing this issue. If you need further help, please comment or file a new issue.

asialasr pushed a commit to asialasr/vscode-cpptools that referenced this issue Mar 12, 2021
VS keeps state of framelevel when break all occurs. gdb assumes when you
break all that the framelevel of current thread is 0. reset the tracking
framelevelid in MIEngine to 0 so that we will call -stack-select-frame
every time we break all if we are expecting a non-zero framelevel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants