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

Possible to call dump from lldb? #1666

Closed
shanekoss opened this issue Jul 11, 2019 · 11 comments
Closed

Possible to call dump from lldb? #1666

shanekoss opened this issue Jul 11, 2019 · 11 comments
Labels
kind: question state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@shanekoss
Copy link

shanekoss commented Jul 11, 2019

  • Describe what you want to achieve.

Would like to be able to dump a json object while debugging. Is there another way to view the object as a string while debugging (without previously inserting a std::cout << test.dump() ?

  • Describe what you tried.

(lldb) p test.dump(1,' ',true,nlohmann::detail::error_handler_t::ignore)

but got error:

error: cannot initialize a parameter of type 'error_handler_t' (aka 'nlohmann::detail::error_handler_t') with an rvalue of type 'int'

  • Describe which system (OS, compiler) you are using.

OSX 10.13.6 / Xcode 10.1

  • Describe which version of the library you are using (release version, develop branch).

3.4.0

Thanks!

@nlohmann
Copy link
Owner

The error handler has a default parameter - can you skip it in the call?

@shanekoss
Copy link
Author

@nlohmann - thanks for the reply.

I've tried that, but then i get the error:

error: too few arguments to function call, expected 4, have 3
'dump' declared here

@nlohmann
Copy link
Owner

Strange. Can you try to used nlohmann::json::error_harndler_t instead?

@shanekoss
Copy link
Author

Sure.

(lldb) p test.dump(1,' ',true,nlohmann::json::error_handler_t::ignore)

produces:

error: 'error_handler_t' (aka 'nlohmann::detail::error_handler_t') is not a class, namespace, or enumeration

@shanekoss
Copy link
Author

just checking back on this - any ideas? thanks!

@stale
Copy link

stale bot commented Sep 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Sep 11, 2019
@shanekoss
Copy link
Author

shanekoss commented Sep 12, 2019

any luck here - is this not possible? cheers.

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Sep 12, 2019
@jaredgrubb
Copy link
Contributor

Can you just put in the number 2 and ignore the type?

@stale
Copy link

stale bot commented Oct 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Oct 13, 2019
@stale stale bot closed this as completed Oct 20, 2019
@jmarrec
Copy link

jmarrec commented Jan 24, 2020

This seems to work somewhat!

(lldb)  p obj->dump(1,' ',true,nlohmann::json::error_handler_t::ignore)
(nlohmann::basic_json<std::__debug::map, std::__debug::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::string_t) $10 = {
  _M_dataplus = (_M_p = "{\n "Water Heater Heat Pump Wrapped Condenser 1": {\n  "air_inlet_node_name": "Node 127",\n  "air_outlet_node_name": "Node 128",\n  "availability_schedule_name": "Always On Discrete",\n  "compressor_location": "Zone",\n  "compressor_setpoint_temperature_schedule_name": "Schedule Ruleset 11",\n  "condenser_bottom_location": 0.0664166667,\n  "condenser_top_location": 0.8634166667,\n  "control_sensor_1_height_in_stratified_tank": 1.262,\n  "control_sensor_1_weight": 0.75,\n  "control_sensor_2_height_in_stratified_tank": 0.464,\n  "dead_band_temperature_difference": 3.89,\n  "dx_coil_name": "Coil Water Heating Air To Water Heat Pump Wrapped 1",\n  "dx_coil_object_type": "Coil:WaterHeating:AirToWaterHeatPump:Wrapped",\n  "evaporator_air_flow_rate": 0.2279,\n  "fan_name": "Fan System Model 4",\n  "fan_object_type": "Fan:SystemModel",\n  "fan_placement": "DrawThrough",\n  "idf_max_extensible_fields": 0,\n  "idf_max_fields": 38,\n  "idf_order": 403,\n  "inlet_air_configuration": "ZoneAirOnly",\n  "inlet_air_humidity_schedule_name": "Sched")
  _M_string_length = 1678
   = (_M_local_buf = char [16] @ 0x00000000029cb6e0, _M_allocated_capacity = 2944)
}

@shanekoss
Copy link
Author

@jmarrec - thanks! That is a lifesaver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

4 participants