Hello Jakob,

Here is a workflow that enables debugging in vscode on macOS/Arm using the 
CodeLLDB debugger:




The gn clean command removes all files and directories  except for 
build.ninja, build.ninja.d and args.gn

```
$ cd v8
$ gn clean out/arm64.debug 
```

To ensure the `args.gn` file is present, write it like so to ensure 
debugging is enabled.

```
$ cat << EOF > out/arm64.debug/args.gn 
is_debug=true
enable_dsyms=true
v8_optimized_debug=false
target_cpu="arm64"
v8_target_cpu="arm64"
is_component_build=true
EOF
```

Generate ninja build files.

```
$ gn -v gen out/arm64.debug
```


Spot check that it has one of our settings.  Note, this is an override from 
default setting of false. (I don't know how but I would like to be able to 
verify all settings with one command.)

```
$ gn args out/arm64.debug --list=enable_dsyms
```

Proceed with build.

```
$ ninja -v -C out/arm64.debug 
```

Thanks again Jakob for pointing out the v8_optimized_debug setting.  That 
disabled optimization (-O0) and prompted me to find the enable_dsyms 
setting.
 

On Wednesday, July 10, 2024 at 2:30:16 PM UTC-4 John Davis wrote:

> Hello Jakob,
>
> Many thanks.  I haven't yet read the workflow you referenced.  I will 
> though.
>
> Regarding the quick try of adding `v8_optimized_debug = false` to my gn 
> gen line - that did not help.  ie.:
>
> `gn -v gen out/arm64.debug --args='is_debug=true target_cpu="arm64" 
> v8_target_cpu="arm64" is_component_build=true v8_optimized_debug=false'`
>
>
>
> On Wednesday, July 10, 2024 at 5:22:53 AM UTC-4 Jakob Kummerow wrote:
>
>> You may be missing the v8_optimized_debug = false build flag.
>> Debug symbols are controlled by the symbol_level flag, which should 
>> default to 2 in debug builds, but it might help to manually set that. FWIW, 
>> on Linux I get 2640 for nm -a out/x64.debug/libv8_libplatform.so | wc -l.
>>
>> I recommend using the recommended building workflow 
>> <https://v8.dev/docs/build-gn#gm>. In short, tools/dev/gm.py arm64.debug 
>> should give you reasonable default settings for debugging (if args.gn 
>> doesn't exist yet; if it does exist, it intentionally leaves it alone).
>>
>>
>> On Tue, Jul 9, 2024 at 6:02 PM 'John Davis' via v8-users <
>> v8-u...@googlegroups.com> wrote:
>>
>>> Hello
>>>
>>> I'm building v8 on macOS with debugging symbols.  (`gn gen ... 
>>> is_debug=true`)  I see the compile command line to include -g2 
>>> -dwarf-aranges, -D_DEBUG, -DDEBUG.  I've compared the `nm` and `nm -a` 
>>> output with and without debug switch.  
>>>
>>> ```
>>> $ ls -lh out/arm64.release/d8
>>>  543K Jul  2 15:37 out/arm64.release/d8*
>>> $ ls -lh out/arm64.debug/d8
>>>  679K Jul  3 12:32 out/arm64.debug/d8*
>>> $ nm -a out/arm64.release/libv8_libplatform.dylib | wc -l
>>>      938
>>> $ nm  out/arm64.release/libv8_libplatform.dylib | wc -l
>>>      404
>>> $ nm -a out/arm64.debug/libv8_libplatform.dylib | wc -l
>>>     1130
>>> $ nm  out/arm64.debug/libv8_libplatform.dylib | wc -l
>>> ```
>>>
>>> It appears debug symbols are present.  However, when I try to run the 
>>> debugger with the CodeLLDB extension for vscode, I can not hit any 
>>> breakpoints.  If I build simple C++ apps with a combined compile/link I can 
>>> hit breakpoints using this method.
>>>
>>> launch.json:
>>> ```
>>> {
>>> "version": "0.2.0",
>>> "configurations": [
>>>   {
>>> "name": "clang++ - Debug exe",
>>> "type": "lldb",
>>> "request": "launch", 
>>> "program": "${workspaceFolder}/v8/out/arm64.debug/d8", 
>>> "args": [
>>> "${workspaceFolder}/data/foo.js"
>>> ],
>>> "cwd": "${workspaceFolder}/v8/out/arm64.debug",
>>> "stopOnEntry": false,
>>>   }
>>> ]
>>>   }
>>> ```
>>>
>>> Any pointers on how to debug v8 code on macOS? 
>>>
>>> This electronic communication and the information and any files 
>>> transmitted with it, or attached to it, are confidential and are intended 
>>> solely for the use of the individual or entity to whom it is addressed and 
>>> may contain information that is confidential, legally privileged, protected 
>>> by privacy laws, or otherwise restricted from disclosure to anyone else. If 
>>> you are not the intended recipient or the person responsible for delivering 
>>> the e-mail to the intended recipient, you are hereby notified that any use, 
>>> copying, distributing, dissemination, forwarding, printing, or copying of 
>>> this e-mail is strictly prohibited. If you received this e-mail in error, 
>>> please return the e-mail to the sender, delete it from your computer, and 
>>> destroy any printed copy of it. 
>>>
>>> -- 
>>>
>>>
-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/52100e01-62d7-49a3-8b08-ad883e614c5an%40googlegroups.com.

Reply via email to